Instead of having this inside both the if and else blocks, we could just move it ahead of the logic.