refactor routes and services