updated the demo code