New triangle handling code in R3