Different solution for matchCards method