even more clean-ups/changing to c++