simplified cardlib code