Better graph cleaning, fix bug in triangulation. #1