Move more stuff back to C++ on the OS X side.
More backporting to C++.