Refactor routing