Replaced deprecated method in example code