cpp version:

minor changes