refactoring routes and resources