             guard index < self.leafCount else {
                 return -1
             }
-            switch self.tree[index] {
-            case .leaf(let symbol):
-                if symbol > -1 {
-                    return symbol
-                }
-            default:
-                continue
+            if self.tree[index] > -1 {
+                return self.tree[index]
             }
         }
     }


class HuffmanTree {

    private enum HTNode {
        case leaf(Int)
        case branch(Set<Int>)
    }

    private var pointerData: DataWithPointer

    private var tree: [HTNode]
    private let leafCount: Int

    private let coding: Bool
    /// Special array for coding part. Index in array = symbol, value in array = index in tree.
    private var codingIndices: [[Int]]

    init(bootstrap: [[Int]], _ pointerData: inout DataWithPointer, _ coding: Bool = false) {
        self.coding = coding

                index = bit == 0 ? 2 * index + 1 : 2 * index + 2
                treeCode >>= 1
            }
            self.tree[index] = length[0]
        }
    }

