diff --git a/theme/pay.theme.inc b/theme/pay.theme.inc
index 7650a72..08c5d99 100644
--- a/theme/pay.theme.inc
+++ b/theme/pay.theme.inc
@@ -132,8 +132,9 @@ function template_preprocess_pay_cc_form(&$variables) {
     foreach ($variables['element']['cc_type']['#options'] as $card => $label) {
       if (empty($card)) continue;
       $variables['element']['cc_type_image'][$card] = array(
-        '#type' => 'markup',
-        '#markup' => theme('image', array('path' => $path . $card . '.png', 'width' => $label)),
+        '#theme' => 'image',
+        '#path' => $path . $card . '.png',
+        '#attributes' => array('class' => array(drupal_html_class($card))),
       );
     }
   }
diff --git a/theme/pay_cc.js b/theme/pay_cc.js
index 78c4c3b..72cbf54 100644
--- a/theme/pay_cc.js
+++ b/theme/pay_cc.js
@@ -2,8 +2,10 @@
  * @file
  * jQuery functions for the credit card form.
  */
+(function ($) {
 
-Drupal.behaviors.payCcType = function(context) {
+Drupal.behaviors.payCcType = {};
+Drupal.behaviors.payCcType.attach = function(context) {
   $('.pay-cc-form:not(.pay-cc-processed)', context).each(function() {
     var $payCcForm = $(this).addClass('pay-cc-processed');
 
@@ -152,3 +154,5 @@ Drupal.pay.setFieldVisibility = function($payCcForm, type) {
   if (show_issue_number) $payCcForm.find('.pay-cc-issue-number').show();
   else $payCcForm.find('.pay-cc-issue-number').hide();
 }
+
+})(jQuery);
