Rewrote indexing algorithm to triangulation. This fixes some incorrectly formed polygons.