More work on C++ version