The typical order is vertex, edge, face(polygon), corner(loop), but in these three functions polys and loops were reversed. Also use more typical "num" variable names rather than "len"