url building refactoring