updated controller and error handler