uploadToS3 refactor