refactored router to be consistent