Original version of libtetrak in C++