Update code snippet to reflect new API