removed nested if