updated demo code