massive cleanup and new features for utils and triangulation