changed the order of filling the mesh