Refactoring of uploading