extract demo code to demo project