Revising and adding Cpp code