More utility functions ported to C++