modified the demo code.