C++ API conversion part 1 (not yet compiling)