modernized c++ code