working on cpp version"