A rewrite of TOC19 in C++