Partially updated to v2 of the API.