More upload refactoring