move function to card.js