big refactoring of Router