Fix some problems and add a triangulation function.