refactoring code for make route