Refactor client side router.