updated controller to fix issues