updated demo with callbacks