Keeps the logic contained within its own function and makes the assignment more straightforward within main().