refactor for AWS