Added classes and logic for selecting cards.