Updated sample for new API