Working version without S3 capture