Refactored active-route code.