added tests for verifying card and improved error checking