final version without s3 storage