moved url testing into a function in prep for async implementation