Port to C++