Wrote the whole C read_mesh routine and a destructor, no memory leaks