merge these functions to downloader.py