Initial conversion of core to C++.