Broke retriangulation function into multiple parts to make it easier to read/maintain