readmesh function - done