simplification of mesh routine