Updated script to support s3 file monitoring