Cleanup upload code. Rename some methods. Update unit test to use new
method names.