router refactoring. seems to work