Moved another bunch of mdlib utils to C++