refactoring router