Begin refactoring router to support plugins