updated example to new api