rewriting the mesh simplification program, not finished