Refactoring by using dynamic routes