refactoring due to start of C++ port