Refactored routes and models