[#2787] Refactor routing.