reference s3 code - new way