Additional refactor to use new SAM APIs.