Refactoring for auto route changing