Cleaned up triangulation

There are still issues with the sorting.
Fixed the sorting