Adapted to the latest changes to the API.