Reimplemented minhash algorithm