Debugged and working for 3-gons.