Reorganized some if statements.