Converted to C++