Refactored card.js