             let projectionDistance = distance(point, projection.point)
             assert(projectionDistance <= maximumDistance)
             let candidate = (point: projection.point,
-                             location: IndexedPathLocation(componentIndex: next.index, locationInComponent: projection.location))
+                             location: IndexedPathLocation(componentIndex: next.index,
+                                                           locationInComponent: projection.location))
             maximumDistance = projectionDistance
             bestSoFar = candidate
         }

                    bestSoFar = IndexedPathComponentLocation(elementIndex: elementIndex, t: projection.t)
                }
            }
            return true // visit chidlren (if they exist)
        }
        if let bestSoFar = bestSoFar {
            return (point: self.point(at: bestSoFar), location: bestSoFar)

    private typealias ComponentTuple = (component: PathComponent, index: Int, lowerBound: CGFloat, upperBound: CGFloat)
    private typealias Candidate = (point: CGPoint, location: IndexedPathLocation)
    private func searchForClosestLocation(to point: CGPoint, maximumDistance: CGFloat, requireBest: Bool) -> (point: CGPoint, location: IndexedPathLocation)? {
        // sort the components by proximity to avoid searching distant components later on
        let tuples: [ComponentTuple] = self.components.enumerated().map { i, component in
            let boundingBox = component.boundingBox
            let lower = boundingBox.lowerBoundOfDistance(to: point)
            let upper = boundingBox.upperBoundOfDistance(to: point)
            return (component: component, index: i, lowerBound: lower, upperBound: upper)
        }.sorted(by: { $0.upperBound < $1.upperBound })
        // iterate through each component and search for closest point
        var bestSoFar: Candidate?
        var maximumDistance = maximumDistance
        for next in tuples {
