Refactoring for async upload