refactoring of routes for clearer code