implemented controller, fixed error reporting