refactor the Router