cpp code added, tests to be added