refactor jdong's s3 work