fixed the demo code organization