diff --git a/commerce_cardonfile.info b/commerce_cardonfile.info
index 469d6e6..e717176 100644
--- a/commerce_cardonfile.info
+++ b/commerce_cardonfile.info
@@ -9,3 +9,5 @@ core = 7.x
 
 ; Simple tests
 ; files[] = tests/commerce_cardonfile.test
+; Rules
+files[] = commerce_cardonfile.rules.inc
diff --git a/commerce_cardonfile.install b/commerce_cardonfile.install
index fa4c628..b13de7b 100644
--- a/commerce_cardonfile.install
+++ b/commerce_cardonfile.install
@@ -27,6 +27,12 @@ function commerce_cardonfile_schema() {
         'not null' => TRUE,
         'default' => 0,
       ),
+      'order_id' => array(
+        'description' => 'The {commerce_order}.order_id that originally supplied this card data.',
+        'type' => 'int',
+        'not null' => TRUE,
+        'default' => 0,
+      ),
       'payment_method' => array(
         'description' => 'The payment method method_id for this transaction.',
         'type' => 'varchar',
@@ -104,6 +110,7 @@ function commerce_cardonfile_schema() {
     'primary key' => array('card_id'),
     'indexes' => array(
       'uid' => array('uid'),
+      'order_id' => array('order_id'),
       'instance_id' => array('instance_id'),
     ),
     'foreign keys' => array(
@@ -111,8 +118,22 @@ function commerce_cardonfile_schema() {
         'table' => 'users',
         'columns' => array('uid' => 'uid'),
       ),
+      'order' => array(
+        'table' => 'commerce_order',
+        'columns' => array('order_id' => 'order_id'),
+      ),
     ),
   );
 
   return $schema;
 }
+
+/**
+ * Implements hook_update_N
+ * Adds the order_id column to the commerce_card_data table.
+*/
+function commerce_cardonfile_update_7001() {
+  $schema = commerce_cardonfile_schema();
+  db_add_field('commerce_card_data', 'order_id', $schema['commerce_card_data']['fields']['order_id']);
+  return t('Added order_id column to commerce_card_data table.');
+}
\ No newline at end of file
diff --git a/commerce_cardonfile.module b/commerce_cardonfile.module
index 8040f47..5afc401 100644
--- a/commerce_cardonfile.module
+++ b/commerce_cardonfile.module
@@ -239,45 +239,47 @@ function commerce_cardonfile_form_alter(&$form, &$form_state, $form_id) {
             );
           }
 
-          // Load any existing card data for the current payment method instance
-          // and user.
-          $stored_cards = commerce_cardonfile_data_load_multiple($form_state['account']->uid, $payment_method['instance_id']);
-
-          // Filter out expired cards.
-          foreach ($stored_cards as $card_id => $card_data) {
-            if ($card_data['card_exp_year'] < date('Y') ||
-              $card_data['card_exp_year'] == date('Y') && $card_data['card_exp_month'] < date('m')) {
-              unset($stored_cards[$card_id]);
-            }
-          }
-
-          // If we found any stored cards, show the options in the form.
-          if (!empty($stored_cards)) {
-            $element = variable_get('commerce_cardonfile_selector', 'radios');
-            $options = commerce_cardonfile_options_list($stored_cards, $element);
-
-            $form['commerce_payment']['payment_details']['cardonfile'] = array(
-              '#type' => $element,
-              '#title' => t('Select a stored credit card'),
-              '#options' => $options,
-              '#default_value' => key($options),
-              '#weight' => -10,
-              '#ajax' => array(
-                'callback' => 'commerce_payment_pane_checkout_form_details_refresh',
-                'wrapper' => 'payment-details',
-              ),
-            );
-
-            // If the current value for the card selection element is not to use
-            // a different credit card, then hide the credit card form elements.
-            if (empty($form_state['values']) || $form_state['values']['commerce_payment']['payment_details']['cardonfile'] !== 'new') {
-              $form['commerce_payment']['payment_details']['credit_card']['#access'] = FALSE;
+          if (!user_is_anonymous()) {
+            // Load any existing card data for the current payment method instance
+            // and user.
+            $stored_cards = commerce_cardonfile_data_load_multiple($form_state['account']->uid, $payment_method['instance_id']);
+  
+            // Filter out expired cards.
+            foreach ($stored_cards as $card_id => $card_data) {
+              if ($card_data['card_exp_year'] < date('Y') ||
+                $card_data['card_exp_year'] == date('Y') && $card_data['card_exp_month'] < date('m')) {
+                unset($stored_cards[$card_id]);
+              }
             }
-
-            // Add the CSS to hide a sole credit card icon if specified.
-            if (variable_get('commerce_cardonfile_hide_cc_radio_button', TRUE)) {
-              if (count($form['commerce_payment']['payment_method']['#options']) == 1) {
-                $form['commerce_payment']['payment_method']['#attached']['css'][] = drupal_get_path('module', 'commerce_cardonfile') . '/theme/commerce_cardonfile.checkout.css';
+  
+            // If we found any stored cards, show the options in the form.
+            if (!empty($stored_cards)) {
+              $element = variable_get('commerce_cardonfile_selector', 'radios');
+              $options = commerce_cardonfile_options_list($stored_cards, $element);
+  
+              $form['commerce_payment']['payment_details']['cardonfile'] = array(
+                '#type' => $element,
+                '#title' => t('Select a stored credit card'),
+                '#options' => $options,
+                '#default_value' => key($options),
+                '#weight' => -10,
+                '#ajax' => array(
+                  'callback' => 'commerce_payment_pane_checkout_form_details_refresh',
+                  'wrapper' => 'payment-details',
+                ),
+              );
+  
+              // If the current value for the card selection element is not to use
+              // a different credit card, then hide the credit card form elements.
+              if (empty($form_state['values']) || $form_state['values']['commerce_payment']['payment_details']['cardonfile'] !== 'new') {
+                $form['commerce_payment']['payment_details']['credit_card']['#access'] = FALSE;
+              }
+  
+              // Add the CSS to hide a sole credit card icon if specified.
+              if (variable_get('commerce_cardonfile_hide_cc_radio_button', TRUE)) {
+                if (count($form['commerce_payment']['payment_method']['#options']) == 1) {
+                  $form['commerce_payment']['payment_method']['#attached']['css'][] = drupal_get_path('module', 'commerce_cardonfile') . '/theme/commerce_cardonfile.checkout.css';
+                }
               }
             }
           }
