Refactor at s3-api