refactoring for downloader