Refactor to use new API.