handle nested if blocks