updated example to use the new listening functions