 }
 
 private class LCSs<T: Hashable> {
-    var sequences = [(HashableArray<T>): Void]()
+    var sequences = Set<HashableArray<T>>()
 }
 
 // Returns all matches with the same length as the bottom right elements

private func trace<T: Equatable>(a1: [T], results: [[Result]], i: Int, j: Int, var sequenceSoFar: [T], sequences: LCSs<T>) {
    sequenceSoFar.append(a1[i - 1])
    if results[i - 1][j - 1].length == 0 {
        sequences.sequences[HashableArray(array: sequenceSoFar)] = ()
    } else {
        for (x, y) in levelMatches(results, i - 1, j - 1) {
            trace(a1, results, x, y, sequenceSoFar, sequences)

        trace(a1, results, x, y, [T](), sequences)
    }
    
    return Array(sequences.sequences).map{$0.array.reverse()}
}
