diff --git a/API.txt b/API.txt
old mode 100644
new mode 100755
diff --git a/README.txt b/README.txt
old mode 100644
new mode 100755
diff --git a/automodal.api.php b/automodal.api.php
old mode 100644
new mode 100755
index aa6786c..c78a606
--- a/automodal.api.php
+++ b/automodal.api.php
@@ -1,4 +1,11 @@
 <?php
+/**
+* @file
+* The theme system, which controls the output of Drupal.
+*
+* The theme system allows for nearly all output of the Drupal system to be
+* customized by user themes.
+*/
 
 /**
  * Alter the settings for an automodal selector.
diff --git a/automodal.info b/automodal.info
index dd9fd4d..ecd9c13 100755
--- a/automodal.info
+++ b/automodal.info
@@ -1,7 +1,8 @@
-
 name = Automodal
 package = User interface
 description = Automatically convert links to modal links.
-core = 6.x
+core = 7.x
 ;php = 5.2
-dependencies[] = modalframe
+files[] = automodal.module
+files[] = automodal.js
+files[] = automodal.api.php
diff --git a/automodal.js b/automodal.js
index c4b1677..049c0c4 100755
--- a/automodal.js
+++ b/automodal.js
@@ -1,11 +1,13 @@
-
+(function ($) {
 (function ($, Drupal, window, undefined) {
 
   /*
    * Add the automodal settings to the selectors.
    */
-  Drupal.behaviors.automodal = function (context) {
-    $.each(Drupal.settings.automodal, function(selector, settings) {
+  Drupal.behaviors.automodal = {};
+  Drupal.behaviors.automodal.attach = {
+  attach: function (context, settings) {
+    $.each(settings.automodal, function(selector, settings) {
       $(selector +':not(.automodal-processed)', context)
         .addClass('automodal-processed')
         .bind('click', function() {
@@ -27,6 +29,7 @@
         });
     });
   }
+}
 
   Drupal.automodal = Drupal.automodal || {};
 
@@ -95,4 +98,5 @@
       Drupal.automodal.onSubmitCallback[i](args, statusMessages);
     }
   }
-})(jQuery, Drupal, window);
\ No newline at end of file
+})(jQuery, Drupal, window);
+})(jQuery);
diff --git a/automodal.module b/automodal.module
index d007ef8..065d60a 100755
--- a/automodal.module
+++ b/automodal.module
@@ -88,8 +88,8 @@ function automodal_menu() {
   $items = array();
 
   $items['admin/settings/automodal'] = array(
-    'title' => t('Automodal Settings'),
-    'description' => t('Configure the automodal behavior.'),
+    'title' => 'Automodal Settings',
+    'description' => 'Configure the automodal behavior.',
     'page callback' => 'drupal_get_form',
     'page arguments' => array('automodal_settings_form'),
     'type' => MENU_NORMAL_ITEM,
@@ -97,8 +97,8 @@ function automodal_menu() {
   );
 
   $items['admin/settings/automodal/test'] = array(
-    'title' => t('Test Frame'),
-    'description' => t('This is a testing frame.'),
+    'title' => 'Test Frame',
+    'description' => 'This is a testing frame.',
     'page callback' => 'automodal_test',
     'page arguments' => array(''),
     'type' => MENU_CALLBACK,
@@ -153,21 +153,29 @@ function automodal_settings_form() {
     '#required' => FALSE,
   );
 
+  $form['automodal_excluded_forms'] = array(
+    '#type' => 'textarea',
+    '#title' => t('(Advanced) Exclude form IDs'),
+    '#description' => t('Exclude automodal from automatically closing on specific forms. Comma seperated.'),
+    '#default_value' => variable_get('automodal_exclude_forms', 'views_exposed_form'),
+    '#required' => FALSE,
+  );
+
   $form['automodal_autoscan'] = array(
     '#type' => 'checkbox',
     '#title' => t('Scan all pages adding automodal automatically.'),
     '#default_value' => variable_get('automodal_autoscan', 1),
   );
 
-  // If not already present add the automodal for the test.
-  automodal_add('.automodal');
+  // If not already present add the automodal for the test. disabled cause it broke the update to d7
+  // automodal_add('.automodal');
 
   $opts = array(
     'attributes' => array('class' => 'automodal'),
   );
   $form['automodal_test'] = array(
     '#type' => 'markup',
-    '#value' => l('This anchor has the class "automodal".', 'admin/settings/automodal/test', $opts) . '<br/>',
+    '#value' => check_plain(l('This anchor has the class "automodal".', 'admin/settings/automodal/test', $opts) . '<br/>'),
   );
 
   return system_settings_form($form);
@@ -178,17 +186,31 @@ function automodal_test() {
 }
 
 /**
- * Implementation of hook_perm().
+ * Implementation of hook_permission().
  */
-function automodal_perm() {
-  return array('administer automodal');
+function automodal_permission() {
+  return array(
+    'administer automodal' => array (
+    'title' => t('Administer automodal'),
+    'description' => t('Perform maintenance tasks for my automodal'),
+  ),
+);
 }
 
 /**
  * Implementation of hook_form_alter()
  */
-function automodal_form_alter(&$form, $form_state, $form_id) {
+function automodal_form_alter(&$form, &$form_state, $form_id) {
   if (automodal_request_is_child() && filter_input(INPUT_GET, 'automodalClose', FILTER_VALIDATE_BOOLEAN)) {
+    // Remove cancel link added by confirm_form when in modalframe.
+    // @see confirm_form
+    if (isset($form['actions']['cancel']) && isset($form['#attributes']['class']) && strpos($form['#attributes']['class'], 'confirmation') === 0) {
+      unset($form['actions']['cancel']);
+    }
+    $excluded_forms = explode(',', variable_get('automodal_excluded_forms', 'views_exposed_form'));
+    if (in_array($form_id, $excluded_forms)) {
+      return;
+    }
     // Name the form submit entry so it can easily be found and replaced
     $form['#submit']['automodal'] = 'automodal_close_form_submit';
   }
