Adjusted the algorithm with rate parameter

and score cutoff for better matching