Adding further C++ core code (all untested)