Tidy up verbose if statements in controller