Created an almost complete port of the minimal example to c++