 
     private enum HTNode {
         case leaf(Int)
-        case branch([Int])
+        case branch(Set<Int>)
     }
 
     private var pointerData: DataWithPointer

                        if rightChildIndex < self.leafCount {
                            switch self.tree[rightChildIndex] {
                            case .leaf(let rightSymbol):
                                replacementArray.append(rightSymbol)
                            case .branch(let rightArray):
                                for rightChild in rightArray {
                                    replacementArray.append(rightChild)
                                }
                            }
                        }

                switch self.tree[treeIndex] {
                case .leaf(let symbol):
                    if symbol == -1 {
                        var replacementArray = Set<Int>()


                        let leftChildIndex = 2 * treeIndex + 1
                        if leftChildIndex < self.leafCount {
                            switch self.tree[leftChildIndex] {
                            case .leaf(let leftSymbol):
                                replacementArray.insert(leftSymbol)
                            case .branch(let leftArray):
                                for leftChild in leftArray {
                                    replacementArray.insert(leftChild)
                                }
                            }
                        }
