Refactoring and clean ups in the route module.