code cleanup on triangulation