Moved url-getter into subfunction