Refactoring routes.js