updates example code to reflect recent API changes