changes to getNextCard() function.