Refactoring routes to use resources and fixed errors in controller