The new implementation could be improved by removing calculations that get repeated when changing triangles and further optimizing return paths.