Added comment to the code. Also added variables for the conditional.