cleaned up the if statements