Added error checking to controller and view