Upload factory cleaned up and refactored.