simplified nested if statements