refactored routes and tests