combined first 2 if statements.