Refactoring polymorphic routes