Example code updated to use the new API