Finish refactoring router.