Move the download code to a separate class