Isolate URL determination to script