refactoring to use dynamic routes