added the download functionality