some improvements to card handling