Why this code wasn't redone in C++ over the years is anyone's guess.

Going to have to wait on my liver to do it's thing before I address this, though.

I'm by no means incapacitated but this code is hairy. Going into it tipsy would be courting disaster.