Making progress with C++ port (kinda).