better implementation for aws s3