Break long function into pieces.
Fix a typo in downloader.