consolidate URL building into helper function