refactor server routes