C++ code used in the TwiScn