Add S3 storage and refactor