Tidy up controller and handle validation errors