Downloading files is now threaded.
Lots of refactoring.