Refactor to integrate Amazon S3