Clean up the triangle code