Updated for changes in the api.