Refactored cardSelection.js