Updated implementation to latest API.