Changed around some if statements