Updated to support latest API changes
Updated example code