Refactored routes.js