Moved 'addToGridFS' to command object to reduce number of arguments being passed around.
Merged addToGridFS and attemptUpload into createTargetFile.
Tidied and removed unused code.