More work on C++ port