cracked the matching algorithm