Refactor router.