Remove duplicated code for download and extracting tarballs