diff --git a/advagg_js_cdn/advagg_js_cdn.module b/advagg_js_cdn/advagg_js_cdn.module
index 53a4b05..7775fe0 100644
--- a/advagg_js_cdn/advagg_js_cdn.module
+++ b/advagg_js_cdn/advagg_js_cdn.module
@@ -7,45 +7,99 @@
  */
 
 /**
+ * Default value to see if jquery should be grabbed from the Google CDN.
+ */
+define('ADVAGG_JS_CDN_JQUERY', TRUE);
+
+/**
+ * Default value to see if jquery-ui should be grabbed from the Google CDN.
+ */
+define('ADVAGG_JS_CDN_JQUERY_UI', TRUE);
+
+/**
+ * Default value to see if SWFObject should be grabbed from the Google CDN.
+ */
+define('ADVAGG_JS_CDN_SWFOBJECT', TRUE);
+
+/**
  * Implement hook_advagg_js_pre_alter.
  */
 function advagg_js_cdn_advagg_js_pre_alter(&$javascript, $preprocess_js, $public_downloads, $scope) {
+  // Exit early if we are not going to CDN any code.
+  $cdn_jquery = variable_get('advagg_js_cdn_jquery', ADVAGG_JS_CDN_JQUERY);
+  $cdn_jquery_ui = variable_get('advagg_js_cdn_jquery_ui', ADVAGG_JS_CDN_JQUERY_UI);
+  $cdn_swfobject = variable_get('advagg_js_cdn_swfobject', ADVAGG_JS_CDN_SWFOBJECT);
+  if (   !$cdn_jquery
+      && !$cdn_jquery_ui
+      && !$cdn_swfobject
+        ) {
+    return FALSE;
+  }
+
+  // Set filepaths/versions
+  $jquery_version = variable_get('advagg_js_cdn_jquery_version', '1.2.6');
+  $jquery_filepath = 'misc/jquery.js';
   if (module_exists('jquery_update')) {
-    $jquery_filepath = drupal_get_path('module', 'jquery_update');
+    $jquery_update_filepath = drupal_get_path('module', 'jquery_update');
+    $jquery_update_version = variable_get('advagg_js_cdn_jquery_update_version', '1.3.2');
   }
   if (module_exists('jquery_ui')) {
     $jquery_ui_version = jquery_ui_get_version();
     $jquery_ui_filepath = advagg_get_jquery_ui_filename();
   }
-  $jquery_update_version = variable_get('advagg_js_cdn_jquery_update_version', '1.3.2');
-  $jquery_version = variable_get('advagg_js_cdn_jquery_version', '1.2.6');
+  if (module_exists('swftools') && function_exists('swftools_get_player_path')) {
+    $swfobject_filepath = swftools_get_player_path() . '/swfobject2/swfobject.js';
+    $swfobject_version = variable_get('advagg_js_cdn_swfobject_version', '2.2');
+  }
 
+  // http or https.
   $schema = (  (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on')
             || (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')
             || (isset($_SERVER['HTTP_HTTPS']) && $_SERVER['HTTP_HTTPS'] == 'on')
               ) ? 'https' : 'http';
   foreach ($javascript as $type => $data) {
+    // Skip inline and setting js.
     if (!$data || $type == 'setting' || $type == 'inline') {
       continue;
     }
+
+    // Search and replace.
     foreach ($data as $path => $info) {
       // jquery.js
-      if (isset($jquery_filepath) && ($path == $jquery_filepath . '/replace/jquery.min.js' || $path == $jquery_filepath . '/replace/jquery.js')) {
-        $info['preprocess'] = FALSE;
-        $javascript['external'][$schema . '://ajax.googleapis.com/ajax/libs/jquery/' . $jquery_update_version . '/jquery.min.js'] = $info;
-        unset($javascript[$type][$path]);
-      }
-      elseif ($path == 'misc/jquery.js') {
-        $info['preprocess'] = FALSE;
-        $javascript['external'][$schema . '://ajax.googleapis.com/ajax/libs/jquery/' . $jquery_version . '/jquery.min.js'] = $info;
-        unset($javascript[$type][$path]);
+      if ($cdn_jquery) {
+        if (isset($jquery_update_filepath) && ($path == $jquery_update_filepath . '/replace/jquery.min.js' || $path == $jquery_filepath . '/replace/jquery.js')) {
+          $info['preprocess'] = FALSE;
+          $javascript['external'][$schema . '://ajax.googleapis.com/ajax/libs/jquery/' . $jquery_update_version . '/jquery.min.js'] = $info;
+          unset($javascript[$type][$path]);
+        }
+        elseif ($path == $jquery_filepath) {
+          $info['preprocess'] = FALSE;
+          $javascript['external'][$schema . '://ajax.googleapis.com/ajax/libs/jquery/' . $jquery_version . '/jquery.min.js'] = $info;
+          unset($javascript[$type][$path]);
+        }
       }
 
       // jquery-ui.js
-      elseif (isset($jquery_ui_filepath) && isset($jquery_ui_version) && $path == $jquery_ui_filepath) {
-        $info['preprocess'] = FALSE;
-        $javascript['external'][$schema . '://ajax.googleapis.com/ajax/libs/jqueryui/' . $jquery_ui_version .'/jquery-ui.min.js'] = $info;
-        unset($javascript[$type][$path]);
+      if ($cdn_jquery_ui) {
+        if (   isset($jquery_ui_filepath)
+            && isset($jquery_ui_version)
+            && $path == $jquery_ui_filepath
+              ) {
+          $info['preprocess'] = FALSE;
+          $javascript['external'][$schema . '://ajax.googleapis.com/ajax/libs/jqueryui/' . $jquery_ui_version .'/jquery-ui.min.js'] = $info;
+          unset($javascript[$type][$path]);
+        }
+      }
+
+      // swfobject.js
+      if ($cdn_swfobject) {
+        if (   isset($swf_object_filepath)
+            && $path == $swf_object_filepath
+              ) {
+          $info['preprocess'] = FALSE;
+          $javascript['external'][$schema . '://ajax.googleapis.com/ajax/libs/swfobject/' . $swfobject_version .'/swfobject.js'] = $info;
+          unset($javascript[$type][$path]);
+        }
       }
     }
   }
