Further work on C++ port