added a more thorough reward matching algorithm