Added sorting of cards
Changed sorting of cards logic