Upload refactor