refactor routing implementation