added hamming distance