Updated the examples code according to the API changes