C++ API conversion (not yet compiling)