Moved URL into function parameter as that is how the function is meant to be called.