cleaned logic up a bit in triangle update