Minor refactoring of if statements.