Refactoring on router