Upload refactoring