Moved encode to its own module.

Removed old encoding code from Encode module and added encoding code
form FileDownloader to Encode module.  All relevant code changes are in
red and green :)