More refactorings to upload system.