refactor(router.rs): make it more functional