[Working] Porting to c++ done