Refactored the upload process.