Cleaned up and optimized downloader.py