refactor downloader