optimize by omit the hamming distance