Moved more map mesh stuff into the MapMesh class

I think this fixes some memory leaks too