Posted the changes made in an attempt to fix the issue with the S3 function