added hamming distance function