Small tuning ond small_k algorithm
Now it only merges paths that intersect at the same level.