starting of porting ptm to C++