Minhashing step and some optimisations