                 break
             }
             // for each curve, recurse on those whose lower bound is equal or better than the best upper bound
+            var exclusions = 0
             for c in list {
-                if lowerBound(point, c) <= bestMax {
+                if lowerBound(point, c) < bestMax {
                     let (left, right) = c.split(at: 0.5)
-                    nextList.append(left)
-                    nextList.append(right)
-                }
-            }
+                    if lowerBound(point, left) < bestMax {
+                        nextList.append(left)
+                    }
+                    else {
+                        exclusions += 1
+                    }
+                    if lowerBound(point, right) < bestMax {
+                        nextList.append(right)
+                    }
+                    else {
+                        exclusions += 1
+                    }
+                }
+                else {
+                    exclusions += 2
+                }
+            }
+           // print("iteration has \(nextList.count) items (excluded \(exclusions) out of \(2*list.count).")
             list = nextList
         }
-        print("finished with \(iterations) iterations")
+      //  print("finished with \(iterations) iterations")
         return LineSegment(p0: bestCurve!.startingPoint, p1: bestCurve!.endingPoint).project(point: point)
     }
     

            // find the best upper bound
            for c in list {
                iterations += 1
                let mmax = upperBound(point, c)
                if mmax < bestMax {
                    bestMax = mmax
                    bestCurve = c


    public func project(point: CGPoint, errorThreshold: CGFloat) -> CGPoint {

        func lowerBound(_ point: CGPoint, _ curve: Self) -> CGFloat {
            // distance from point to curve >= this number
            let line = LineSegment(p0: curve.startingPoint, p1: curve.endingPoint)
