Update deprecated API

Although the update you pulled does work it reports a deprecated API, which I had missed.

This is the updated API.