Converted everything to c++