refactored routes, and added some flexibility there