diff --git a/hide_submit.info b/hide_submit.info
index c758c37..1d96d9c 100644
--- a/hide_submit.info
+++ b/hide_submit.info
@@ -1,6 +1,5 @@
 name = "Hide submit button"
 description = "Hide submit button after clicked to avoid duplicate posting"
 
-configure = admin/config/content/hide-submit 
+configure = admin/config/content/hide-submit
 core = 7.x
-
diff --git a/hide_submit.install b/hide_submit.install
index bcd3507..3ebd63e 100644
--- a/hide_submit.install
+++ b/hide_submit.install
@@ -12,8 +12,7 @@
  * Implement hook install
  */
 function hide_submit_install() {
-  // TODO update_sql has been removed. Use the database API for any schema or data changes.
-  // update_sql("UPDATE {system} SET weight = 10 WHERE type = 'module' AND name = 'hide_submit'");
+  db_query("UPDATE {system} SET weight = 10 WHERE type = 'module' AND name = 'hide_submit'");
   drupal_set_message( st('Hide submit module installed.') );
 }
 
diff --git a/hide_submit.js b/hide_submit.js
index 4b545b5..b3f4279 100644
--- a/hide_submit.js
+++ b/hide_submit.js
@@ -1,5 +1,5 @@
 (function($) {
-	
+
 Drupal.behaviors.hide_submit = {
   attach: function(context, settings) {
     // getting the seetings from Drupal.settings
@@ -36,12 +36,12 @@ Drupal.behaviors.hide_submit = {
 	    });
 	  }
     }
-	  
+
     // Hide button and siblings
     function hide_submit_button(obj, message, context) {
       $(obj, context).hide().siblings('input:submit').hide().end().after(message);
     }
-  
+
     // Disable button and siblings
     function disable_submit_button(obj, context) {
       var $obj = $(obj, context);
@@ -58,4 +58,4 @@ Drupal.behaviors.hide_submit = {
   }
 };
 
-}(jQuery));
\ No newline at end of file
+})(jQuery);
diff --git a/hide_submit.module b/hide_submit.module
index e29f71c..c1f9576 100644
--- a/hide_submit.module
+++ b/hide_submit.module
@@ -100,7 +100,6 @@ function hide_submit_menu() {
  * Implements hook_init().
  */
 function hide_submit_init() {
-
   if (!hide_submit_js_loaded() && _hide_submit_load_js_check_condition()) {
     drupal_add_js(_hide_submit_get_javascript_settings(), array('type' => 'setting', 'scope' => JS_DEFAULT));
     drupal_add_js(drupal_get_path('module', 'hide_submit') . '/hide_submit.js');
@@ -110,13 +109,12 @@ function hide_submit_init() {
 
 
 /**
- * Memory function for checking or setting script status
+ * Memory function for checking or setting script status.
  *
  * @param mixed $status - new status or NULL to leave status unchanged
  * @returns TRUE or FALSE indicating script was loaded
  */
 function hide_submit_js_loaded($status = NULL) {
-
   static $hide_submit_js_loaded = FALSE;
 
   if ($status !== NULL) {
@@ -132,27 +130,25 @@ function hide_submit_js_loaded($status = NULL) {
  * Used to add "hide-submit-exclude" class to some forms
  * Avoid conflicts and refine hiding
  */
-function hide_submit_form_alter(&$form, $form_state, $form_id) {
-
-  // Act only if script was loaded
+function hide_submit_form_alter(&$form, &$form_state, $form_id) {
+  // Act only if script was loaded.
   if (!hide_submit_js_loaded()) {
     return;
   }
 
   $exclude_forms = explode("\r\n", variable_get('hide_submit_form_exclusion', ''));
 
-
   $found = FALSE;
   $mode = variable_get('hide_submit_form_exclusion_mode', HIDE_SUBMIT_EXCLUDE_LISTED_FORMS);
 
-  // Prevent known conflicts by adding form ids of known ajax forms
+  // Prevent known conflicts by adding form ids of known ajax forms.
   if (variable_get('hide_submit_fix_known_conflicts', TRUE) && $mode == HIDE_SUBMIT_EXCLUDE_LISTED_FORMS) {
 
-    // shoutbox module
+    // Shoutbox module.
     if (module_exists('shoutbox')) {
       $exclude_forms[] = 'shoutbox_add_form';
       if (_hide_submit_debug_on()) {
-        drupal_set_message("hide submit: Possible conflict detected and handled - shoutbox module");
+        drupal_set_message(t("hide submit: Possible conflict detected and handled - shoutbox module"));
       }
     }
   }
@@ -164,7 +160,7 @@ function hide_submit_form_alter(&$form, $form_state, $form_id) {
         _hide_submit_add_exclude_class($form);
 
         if (_hide_submit_debug_on()) {
-          drupal_set_message("hide_submit: Excluding form " . $exclude_form_id);
+          drupal_set_message(t("hide_submit: Excluding form @form", array('@form' => $exclude_form_id)));
         }
       }
     }
@@ -174,11 +170,11 @@ function hide_submit_form_alter(&$form, $form_state, $form_id) {
     _hide_submit_add_exclude_class($form);
 
     if (_hide_submit_debug_on()) {
-      drupal_set_message("hide_submit: Excluding form " . $form_id);
+      drupal_set_message(t("hide_submit: Excluding form @form", array('@form' => $form_id)));
     }
   }
 
-  // Comment workaround
+  // Comment workaround:
   // When disable button mode is selected
   // Comments won't submit because disabled button value is not included in the $_POST[] data
   // This workaround should fix this
@@ -229,7 +225,6 @@ function _hide_submit_add_exclude_class(&$elements) {
  * Check if JS should be loaded for current page
  */
 function _hide_submit_load_js_check_condition() {
-
   $js_load_option = variable_get('hide_submit_js_load_option', HIDE_SUBMIT_DEFAULT_JS_LOAD);
 
   switch ($js_load_option) {
@@ -334,12 +329,14 @@ function _hide_submit_get_message() {
     $message = variable_get('hide_submit_message', HIDE_SUBMIT_DEFAULT_MESSAGE);
   }
 
-  $image =  _hide_submit_get_image( );
+  $image =  _hide_submit_get_image();
 
   if ($image !== FALSE) {
-    $image = '<img src="'.file_create_url($image).'" alt="" title=""  /> &nbsp;';
+    $tip_message = empty($message) ? t('Please wait...') : $message;
+    $variables = array('path' => file_create_url($image), 'alt' => $tip_message, 'title' => $tip_message);
+    $image = theme('image', $variables) .'&nbsp;';
   }
-
+  // TODO: move this to a theme function.
   return '<p class="hide_submit">' . $image . ' ' . $message . ' </p>';
 }
 
@@ -347,7 +344,6 @@ function _hide_submit_get_message() {
  * Get javascript code for injection
  */
 function _hide_submit_get_javascript_settings() {
-
   // Set base path for local image, none for external
   $image = _hide_submit_get_image();
   if ($image !== FALSE) {
@@ -371,7 +367,6 @@ function _hide_submit_get_javascript_settings() {
     }
   }
 
-
   $mode = (variable_get('hide_submit_script_mode', HIDE_SUBMIT_MODE_HIDE) == HIDE_SUBMIT_MODE_HIDE) ? "hide" : "disable";
 
   $settings = array(
@@ -383,7 +378,6 @@ function _hide_submit_get_javascript_settings() {
     ),
   );
 
-
   // Add Message and image only when needed
   if ($mode == 'hide') {
     $settings['hide_submit']['message'] = filter_xss_admin( _hide_submit_clean_for_javascript( _hide_submit_get_message() ) );
diff --git a/hide_submit_admin.inc b/hide_submit_admin.inc
index 2e59519..7e84819 100644
--- a/hide_submit_admin.inc
+++ b/hide_submit_admin.inc
@@ -14,8 +14,7 @@
  * @param $filename - The file to delete
  * @return drupal form array
  */
-function hide_submit_admin_delete_image($form, &$form_state, $filename) {
-
+function hide_submit_admin_delete_image(&$form, &$form_state, $filename) {
   $filepath = HIDE_SUBMIT_IMG_DIRECTORY . '/' . $filename;
 
   if (!file_exists(HIDE_SUBMIT_IMG_DIRECTORY . '/' . $filename)) {
@@ -31,7 +30,7 @@ function hide_submit_admin_delete_image($form, &$form_state, $filename) {
     '#value' => $filename,
   );
 
-  $msg = t('Are you sure you want to delete the image file %name', array('%name' => check_plain($filename)));
+  $msg = t('Are you sure you want to delete the image file %name', array('%name' => $filename));
 
   return confirm_form($form, $msg, 'admin/config/content/hide-submit');
 }
@@ -43,13 +42,12 @@ function hide_submit_admin_delete_image($form, &$form_state, $filename) {
  * @param &$form_state
  */
 function hide_submit_admin_delete_image_submit($form, &$form_state) {
-
   $filepath = $form_state['values']['hide_submit_image_file_path'];
   $filename = $form_state['values']['hide_submit_image_file_name'];
 
   if (file_unmanaged_delete($filepath)) {
 
-    drupal_set_message( t('%name deleted succesfully.', array('%name' => check_plain($filename))) );
+    drupal_set_message(t('%name deleted succesfully.', array('%name' => $filename)));
     $image = variable_get('hide_submit_image', HIDE_SUBMIT_DEFAULT_IMAGE);
 
     // After deleting we need to check if the deleted image was selected
@@ -227,7 +225,7 @@ function hide_submit_admin_settings($form, &$form_state) {
   // jpg, jpeg, gif, png (file_scan_directory using ereg)
   $mask = "@^.+\.(([jJ][pP][gG)|([jJ][pP][eE][gG])|([gG][iI][fF])|([pP][nN][gG]))$@";
 
-  $default_images = file_scan_directory((HIDE_SUBMIT_MODULE_DIRECTORY .'/images'), $mask);
+  $default_images = file_scan_directory((HIDE_SUBMIT_MODULE_DIRECTORY . '/images'), $mask);
   $user_images = file_scan_directory((HIDE_SUBMIT_IMG_DIRECTORY), $mask);
 
   $options = array();
@@ -411,7 +409,7 @@ function hide_submit_admin_settings_submit($form, &$form_state) {
   }
   // Randomize
   elseif ($values->hide_submit_toggle_random) {
-    drupal_set_message("Random image feature is set...");
+    drupal_set_message(t("Random image feature is set..."));
     $images_to_random = array();
     foreach ($values->hide_submit_random as $key => $v) {
       if ($v) {
diff --git a/hide_submit_admin_settings.js b/hide_submit_admin_settings.js
index 87ab239..8be44fa 100644
--- a/hide_submit_admin_settings.js
+++ b/hide_submit_admin_settings.js
@@ -1,22 +1,24 @@
 (function ($) {
 
-Drupal.behaviors.hide_submit_admin_settings = function(context) {
-    function hs_custom_image_toggle(use_custom_link) {
-        $img = $("#edit-hide-submit-custom-image-link-wrapper", context);
-        if (use_custom_link) {
-            $img.show();
-        }
-        else {
-            $img.hide(); 
+Drupal.behaviors.hide_submit_admin_settings = {
+    attach: function(context) {
+        function hs_custom_image_toggle(use_custom_link) {
+            $img = $("#edit-hide-submit-custom-image-link-wrapper", context);
+            if (use_custom_link) {
+                $img.show();
+            }
+            else {
+                $img.hide();
+            }
         }
+        var $toggleCustomImage = $("#edit-hide-submit-toggle-custom-image", context);
+        $toggleCustomImage.each(function() {
+          hs_custom_image_toggle($(this).attr("checked"));
+        });
+        $toggleCustomImage.click(function() {
+          hs_custom_image_toggle($(this).attr("checked"));
+        });
     }
-    var $toggleCustomImage = $("#edit-hide-submit-toggle-custom-image", context);
-    $toggleCustomImage.each(function() {
-      hs_custom_image_toggle($(this).attr("checked"));
-    });
-    $toggleCustomImage.click(function() {
-      hs_custom_image_toggle($(this).attr("checked"));
-    });
 };
 
-})(jQuery);
\ No newline at end of file
+})(jQuery);
