refactor router to accept flat pathnames