added cards matching function