Refactoring routes to use resources