extracted to card.js