Updated C++ version.