revised the router to more standard pattern