def cluster_old(matches, gap, miin):
    """Clusters matches based un Chebyshev distance, with gap as maximum distance and min as minimum cluster size"""
    temp = [[matches[0]]]
    for x in matches[1:]:
        for y in temp:
            t = False
            for z in y:
                if max(abs(x[0] - z[0]), abs(x[1] - z[1])) < gap:
                    t = True
                    break
            if t:
                y.append(x)
            else:
                temp.append([x])
    merges = []
    for i, x in enumerate(temp):
        for y in x:
            for j, z in enumerate(temp[i + 1:], i + 1):
                if (i, j) not in merges and y in z:
                    merges.append((i, j))
    output = []
    exclude = []
    for i, x in enumerate(merges):
        output.append(temp[x[0]].extend([x for x in temp[x[1]] if x not in
            temp[x[0]]]))
        exclude.extend([x[0], x[1]])
    output.extend([x for x in temp if x not in exclude])
    return [x for x in output if len(x) >= miin]
