Added to triangles, cleaned up code and unit test