Refactors by extracting a download url function