more refactoring and definitions of C++ classes/objects