cleaned the download code