Added exception handling to the card module.