Modified to store data in Amazon S3