refactor into routes