many changes in c++ demo