Change router to use multimethod instead of conditional