refactoring routes to use resources