Update function to match new api.