Updated demo1 to compile on Mac OS X and Windows