switch more functions over to C++