C++ related refactoring