This is version 2 of cards.c