Nested if statements to improve readability