added experimental threading to cpp version