Refactors downloader module splitting download logic into functions