Refactor routing a bit