refactor s3 transactions