updated example for new async interface
extended functionality