         Draw.reset(context)
     }
 
-    private func pointIsContainedInBooleanResult(point: CGPoint, operation: BooleanPathOperation) -> Bool {
+    internal func performOperation() -> Path {
+        func performOperation(for components: [Node], appendingToComponents list: inout [PathComponent]) {
+            components.forEach {
+                self.forEachNode(in: $0) { node, _ in
+                    guard node.edge?.inSolution == true, node.edge?.visited == false else { return }
+                    list.append(self.createComponent(from: node))
+                }
+            }
+        }
+        var components = [PathComponent]()
+        performOperation(for: self.graph1, appendingToComponents: &components)
+        performOperation(for: self.graph2, appendingToComponents: &components)
+        return Path(components: components)
+    }
+}
+
+private extension AugmentedGraph {
+
+    func pointIsContainedInBooleanResult(point: CGPoint, operation: BooleanPathOperation) -> Bool {
         let rule: PathFillRule = (operation == .removeCrossings) ? .winding : .evenOdd
         let contained1 = self.path1.contains(point, using: rule)
-        guard operation != .removeCrossings else { return contained1 }
-        let contained2 = self.path2.contains(point, using: rule)
+        let contained2 = operation != .removeCrossings ? self.path2.contains(point, using: rule) : contained1
         switch operation {
         case .union:
             return contained1 || contained2

        }
    }

    static func sortAndMergeDuplicates(of nodes: inout [IntersectionNode]) {
        guard nodes.count > 1 else { return }
        nodes.sort(by: { $0.location < $1.location })
        var duplicatesRemoved = [nodes[0]]

        nodes = duplicatesRemoved
    }

    func createComponent(from node: Node) -> PathComponent {
        var points: [CGPoint] = [node.edge!.component.startingPoint]
        var orders = [Int]()
        func visit(from node: Node) -> Node? {
            guard let forwardEdge = node.edge else {
                assertionFailure("consistency failure")
                return nil
