update code to match updated API