diff --git a/content_lock.admin.inc b/content_lock.admin.inc
index 9fc4126..8045968 100644
--- a/content_lock.admin.inc
+++ b/content_lock.admin.inc
@@ -8,30 +8,30 @@
  */
 function content_lock_admin_settings() {
   $form['content_lock_unload_js'] = array(
-      '#type' => 'checkbox',
-      '#title' => t('Use javascript to detect leaving the node form'),
-      '#description' => t('If you disable this, there will be no messages like “Do you really want to leave this node and lose all changes? The lock will be removed if you proceed.”. Also, disabling this will cause nodes to remain locked if the user avoids saving the node and does not use the cancel button (i.e., by clicking a menu link to navigate away from a node-edit page).'),
-      '#default_value' => variable_get('content_lock_unload_js', true),
+    '#type' => 'checkbox',
+    '#title' => t('Use javascript to detect leaving the node form'),
+    '#description' => t('If you disable this, there will be no messages like “Do you really want to leave this node and lose all changes? The lock will be removed if you proceed.”. Also, disabling this will cause nodes to remain locked if the user avoids saving the node and does not use the cancel button (i.e., by clicking a menu link to navigate away from a node-edit page).'),
+    '#default_value' => variable_get('content_lock_unload_js', TRUE),
   );
   $form['content_lock_unload_js_message'] = array(
-      '#type' => 'textfield',
-      '#title' => t('Javascript popup message text'),
-      '#description' => t('This option allows you to modify the text the user sees when navigating away from an edited node.'),
-      '#default_value' => variable_get('content_lock_unload_js_message', 'If you proceed, ALL of your changes will be lost.'),
+    '#type' => 'textfield',
+    '#title' => t('Javascript popup message text'),
+    '#description' => t('This option allows you to modify the text the user sees when navigating away from an edited node.'),
+    '#default_value' => variable_get('content_lock_unload_js_message', 'If you proceed, ALL of your changes will be lost.'),
   );
 
   $form['content_lock_admin_verbose'] = array(
-      '#type' => 'checkbox',
-      '#title' => t('Show lock / unlock messages'),
-      '#description' => t('This option controls whether or not content_lock inform the user that he has locked/unlocked a node. This does not control the javascript dialogues.'),
-      '#default_value' => variable_get('content_lock_admin_verbose', true),
+    '#type' => 'checkbox',
+    '#title' => t('Show lock / unlock messages'),
+    '#description' => t('This option controls whether or not content_lock inform the user that he has locked/unlocked a node. This does not control the javascript dialogues.'),
+    '#default_value' => variable_get('content_lock_admin_verbose', TRUE),
   );
 
   $form['content_lock_admin_cancelbutton'] = array(
-      '#type' => 'checkbox',
-      '#title' => t('Add cancel button'),
-      '#description' => t('Adds a cancel button to the node / user / comment form. This way a user can properly cancel the transaction.'),
-      '#default_value' => variable_get('content_lock_admin_cancelbutton', true),
+    '#type' => 'checkbox',
+    '#title' => t('Add cancel button'),
+    '#description' => t('Adds a cancel button to the node / user / comment form. This way a user can properly cancel the transaction.'),
+    '#default_value' => variable_get('content_lock_admin_cancelbutton', TRUE),
   );
 
   $node_types = array();
diff --git a/content_lock.install b/content_lock.install
index d8132d2..6181ace 100644
--- a/content_lock.install
+++ b/content_lock.install
@@ -1,7 +1,7 @@
 <?php /* -*- mode: php; indent-tabs-mode: nil; tab-width: 2; -*- */
 
 /**
- * Implement hook_install().
+ * Implements hook_install().
  *
  * Enable the 'check out documents' permission for authenticated users
  * by default since this is the most common use-case.
@@ -11,7 +11,7 @@ function content_lock_install() {
 }
 
 /**
- * Implementation of hook_uninstall().
+ * Implementats hook_uninstall().
  */
 function content_lock_uninstall() {
   variable_del('content_lock_clear');
@@ -24,7 +24,7 @@ function content_lock_uninstall() {
 }
 
 /*
- * Implementaion of hook_schema().
+ * Implements hook_schema().
  */
 function content_lock_schema() {
   $schema['content_lock'] = array(
@@ -72,10 +72,9 @@ function content_lock_schema() {
 }
 
 /**
- * Implementation of hook_update_N().
+ * Implements hook_update_N().
  */
-function content_lock_update_6200()
-{
+function content_lock_update_6200() {
   $ret = array();
 
   db_add_field($ret, 'content_lock', 'ajax_key',
diff --git a/content_lock.module b/content_lock.module
index 864d5fc..bd5fd8a 100644
--- a/content_lock.module
+++ b/content_lock.module
@@ -6,43 +6,43 @@
  */
 
 /**
- * Implementation of hook_permission().
+ * Implements hook_permission().
  */
 function content_lock_permission() {
   return array(
     'check out documents' => array(
       'title' => t('Check Out/Lock Documents'),
       'description' => t('Enables users to lock documents and requires them to respect locks others have made.'),
-     ),
+    ),
     'administer checked out documents' => array(
       'title' => t('Administer Checked Out Documents'),
       'description' => t('Enables administrators to view and break locks made by other users.'),
       'restrict access' => TRUE,
-     ),
-   );
+    ),
+  );
 }
 
 /**
- * Implementation of hook_help().
+ * Implements hook_help().
  */
 function content_lock_help($path, $arg) {
   switch ($path) {
     case 'admin/help#content_lock':
-      $output = '<p>'. t("Drupal's default content locking strategy is optimistic, that is, two users may start to edit the same content and the one who is hitting the save button first wins the race, while the other is displayed a message stating <em>this content has been modified by another user, changes cannot be saved</em>.  Depending on the number of editors in your organization this might not be an acceptable solution.") .'</p>';
-      $output .= '<p>'. t('The Content locking module implements pessimistic locking, which means that content will be exclusively locked whenever a user starts editing it.  The lock will be automatically released when the user submits the form or navigates away from the edit page.') .'</p>';
-      $output .= '<p>'. t('Users may also permanently lock content, to prevent others from editing it.  Content locks that have been "forgotten" can be automatically released after a configurable time span.') .'</p>';
+      $output = '<p>' . t("Drupal's default content locking strategy is optimistic, that is, two users may start to edit the same content and the one who is hitting the save button first wins the race, while the other is displayed a message stating <em>this content has been modified by another user, changes cannot be saved</em>.  Depending on the number of editors in your organization this might not be an acceptable solution.") . '</p>';
+      $output .= '<p>' . t('The Content locking module implements pessimistic locking, which means that content will be exclusively locked whenever a user starts editing it.  The lock will be automatically released when the user submits the form or navigates away from the edit page.') . '</p>';
+      $output .= '<p>' . t('Users may also permanently lock content, to prevent others from editing it.  Content locks that have been "forgotten" can be automatically released after a configurable time span.') . '</p>';
       return $output;
 
     case 'admin/content/content_lock':
-      return '<p>'. t('Below is a list of all locked documents. Click on <em>!checkin</em> to release a lock.', array('!checkin' => t('release lock'))) .'</p>';
+      return '<p>' . t('Below is a list of all locked documents. Click on <em>!checkin</em> to release a lock.', array('!checkin' => t('release lock'))) . '</p>';
 
     case 'user/%/content_lock':
-      return '<p>'. t('Below is a list of all documents locked by you. Click on <em>!checkin</em> to release a lock.', array('!checkin' => t('release lock'))) .'</p>';
+      return '<p>' . t('Below is a list of all documents locked by you. Click on <em>!checkin</em> to release a lock.', array('!checkin' => t('release lock'))) . '</p>';
   }
 }
 
 /**
- * Implementation of hook_menu().
+ * Implements hook_menu().
  */
 function content_lock_menu() {
   $items['admin/content/content_lock'] = array(
@@ -74,12 +74,12 @@ function content_lock_menu() {
     'weight' => 5,
     'type' => MENU_LOCAL_TASK
   );
-  $items['ajax/content_lock/%/canceledit'] = array (
+  $items['ajax/content_lock/%/canceledit'] = array(
     'page callback' => 'content_lock_release_own_item',
-    'page arguments' => array(2,false),
-    'access callback' => true
+    'page arguments' => array(2, FALSE),
+    'access callback' => TRUE,
   );
-  $items['admin/config/content/content_lock'] = array (
+  $items['admin/config/content/content_lock'] = array(
     'type' => MENU_NORMAL_ITEM,
     'title' => 'Content lock',
     'description' => 'Configuration options for the Content lock module',
@@ -87,13 +87,13 @@ function content_lock_menu() {
     'page arguments' => array('content_lock_admin_settings'),
     'access arguments' => array('administer site configuration'),
     'file' => 'content_lock.admin.inc'
-   );
+  );
 
   return $items;
 }
 
 /**
- * Implement hook_node_validate() to check that the user is
+ * Implements hook_node_validate() to check that the user is
  * maintaining his lock.
  *
  * @param $node
@@ -111,7 +111,7 @@ function content_lock_node_validate($node, $form, &$form_state) {
     if ($lock = content_lock_fetch_lock($node->nid)) {
       if ($lock->uid != $user->uid) {
         // Lock is no longer ours.
-        form_set_error('changed', t('Your lock has been removed!') .'<br />'. content_lock_lock_owner($lock) .'<br />'. t('You can still save the content if this user aborts the edit operation without saving changes.'));
+        form_set_error('changed', t('Your lock has been removed!') . '<br />' . content_lock_lock_owner($lock) . '<br />' . t('You can still save the content if this user aborts the edit operation without saving changes.'));
       }
     }
     else {
@@ -125,7 +125,7 @@ function content_lock_node_validate($node, $form, &$form_state) {
 }
 
 /**
- * Implement hook_node_update() to unlock a node after it's saved.
+ * Implements hook_node_update() to unlock a node after it's saved.
  *
  * This hook is invoked after hook_node_save() is invoked and after
  * the changes to the node are actually saved to the database, so it's
@@ -143,7 +143,7 @@ function content_lock_node_update($node) {
 }
 
 /**
- * Implement hook_node_delete() to remove references to deleted nodes
+ * Implements hook_node_delete() to remove references to deleted nodes
  * from the lock tables.
  *
  * @param $node
@@ -154,7 +154,7 @@ function content_lock_node_delete($node) {
 }
 
 /**
- * Implement hook_node_view() to inform user if he's holding locks on
+ * Implements hook_node_view() to inform user if he's holding locks on
  * other nodes.
  *
  * @param $node
@@ -185,7 +185,7 @@ function content_lock_node_view($node, $view_mode, $langcode) {
 }
 
 /**
- * Implementation of hook_form_alter().
+ * Implements hook_form_alter().
  */
 function content_lock_form_alter(&$form, &$form_state, $form_id) {
   global $user;
@@ -199,21 +199,21 @@ function content_lock_form_alter(&$form, &$form_state, $form_id) {
   // Only touch node edit forms and then only if the form is `normal' and has a body with a format (#1183678):
   if (is_object($node) && is_numeric($nid) && $node->type . '_node_form' == $form_id && !empty($node->body[$node->language][0]['format'])) {
     $old_format = $node->body[$node->language][0]['format'];
-      if (!empty($node->content_lock_old_format)) {
-        $old_format = $node->content_lock_old_format;
-      }
-      if (!empty($form_state['values']['content_lock_old_format'])) {
-        $old_format = $form_state['values']['content_lock_old_format'];
-      }
-      // Needs to be manually set before first form submission.
-      // We set this in the $node-> namespace because content_lock_nodeapi()
-      // doesn't see $form_state['values'].
-      $node->content_lock_old_format = $old_format;
-
-      $form['content_lock_old_format'] = array(
-        '#type' => 'hidden',
-        '#value' => $node->content_lock_old_format,
-      );
+    if (!empty($node->content_lock_old_format)) {
+      $old_format = $node->content_lock_old_format;
+    }
+    if (!empty($form_state['values']['content_lock_old_format'])) {
+      $old_format = $form_state['values']['content_lock_old_format'];
+    }
+    // Needs to be manually set before first form submission.
+    // We set this in the $node-> namespace because content_lock_nodeapi()
+    // doesn't see $form_state['values'].
+    $node->content_lock_old_format = $old_format;
+
+    $form['content_lock_old_format'] = array(
+      '#type' => 'hidden',
+      '#value' => $node->content_lock_old_format,
+    );
   }
 
   /** ******************* General preconditions for locking ***************** */
@@ -222,44 +222,44 @@ function content_lock_form_alter(&$form, &$form_state, $form_id) {
   // Be sure to notice that content_lock also implements this api for his own vetos!
   $skip_lock = FALSE; // no veto yet
   $result = module_invoke_all('content_lock_skip_locking', $node, $form_id, $form, $form_state);
-  foreach($result as $bool) {
+  foreach ($result as $bool) {
     if (is_bool($bool)) {
       $skip_lock = $skip_lock || $bool;
     }
   }
 
   if ($skip_lock == FALSE) {
-      // if we should lock or already have been locked, load the unload js. Dont use
-      // form alter but rather after build, so it works even for previews
-      if(variable_get('content_lock_unload_js', true)) {
-        $form['#after_build'][] = '_content_lock_add_unload_js';
-      }
+    // if we should lock or already have been locked, load the unload js. Dont use
+    // form alter but rather after build, so it works even for previews
+    if (variable_get('content_lock_unload_js', TRUE)) {
+      $form['#after_build'][] = '_content_lock_add_unload_js';
+    }
 
-      // Adding cancel button, if configured
-      if(variable_get('content_lock_admin_cancelbutton', true)) {
-        _content_lock_add_cancelbutton($form, $form_state, $form_id);
-      }
-      // If we are handling a preview, skip locking
-      if(!empty($form_state['rebuild']) && $form_state['rebuild'] == TRUE) {
-        // We dont need anything here right now
-      }
-      // If the form did not get submitted we show it the first time
-      // so try to get the lock if possible
-      else if ($form_state['submitted'] === FALSE) {
-        // Finally set the lock if everthing passed.
-        if(content_lock_node($nid, $user->uid) == false) {
-          // could not lock node, its locked by someone else
-          drupal_goto("node/$nid");
-        }
+    // Adding cancel button, if configured
+    if (variable_get('content_lock_admin_cancelbutton', TRUE)) {
+      _content_lock_add_cancelbutton($form, $form_state, $form_id);
+    }
+    // If we are handling a preview, skip locking
+    if (!empty($form_state['rebuild']) && $form_state['rebuild'] == TRUE) {
+      // We dont need anything here right now
+    }
+    // If the form did not get submitted we show it the first time
+    // so try to get the lock if possible
+    elseif ($form_state['submitted'] === FALSE) {
+      // Finally set the lock if everthing passed.
+      if (content_lock_node($nid, $user->uid) == FALSE) {
+        // could not lock node, its locked by someone else
+        drupal_goto("node/$nid");
       }
-      // else if($form_state['submitted'] === TRUE)
-      // if it is a submission, we would not need to lock once again, as we had before.
-      // as nodeapi insert/update are not called on preview, the node should stay locked until saved or canceled.
+    }
+    // else if($form_state['submitted'] === TRUE)
+    // if it is a submission, we would not need to lock once again, as we had before.
+    // as nodeapi insert/update are not called on preview, the node should stay locked until saved or canceled.
   }
 }
 
-/*
- *  Implementation of our own skip_locking api to implement our logic to skip locks
+/**
+ * Implementation of our own skip_locking api to implement our logic to skip locks
  */
 function content_lock_content_lock_skip_locking($node, $form_id, $form, $form_state) {
   global $user;
@@ -275,12 +275,12 @@ function content_lock_content_lock_skip_locking($node, $form_id, $form, $form_st
     'comment_form' => TRUE,    // dont lock on comment forms
   );
 
-  if($node != NULL) {
-   $form_id_blacklist['node_type_form'] = TRUE;  // add the node-type administration
+  if ($node != NULL) {
+    $form_id_blacklist['node_type_form'] = TRUE;  // add the node-type administration
   }
   // Let other modules modify our blacklist
   drupal_alter('content_lock_form_id_blacklist', $form_id_blacklist, $node);
-  if($node == NULL                                // If we somehow have no node, no need to lock at all
+  if ($node == NULL                                // If we somehow have no node, no need to lock at all
       || empty($nid)
       || !empty($node_type_blacklist[$node->type])// If this node is blacklisted, don't lock.
       || !empty($form_id_blacklist[$form_id])     // If this form is blacklisted, don't lock.
@@ -305,7 +305,7 @@ function content_lock_content_lock_skip_locking($node, $form_id, $form, $form_st
 }
 
 function _content_lock_add_unload_js(&$form, $form_state) {
-  $m = drupal_get_path('module','content_lock');
+  $m = drupal_get_path('module', 'content_lock');
   drupal_add_js("$m/js/jquery.url.packed.js", array('group' => JS_LIBRARY));
   drupal_add_js("$m/js/onUserExit.js", array('group' => JS_LIBRARY));
   drupal_add_js("$m/js/content_lock_init.js");
@@ -315,7 +315,7 @@ function _content_lock_add_unload_js(&$form, $form_state) {
 }
 
 function _content_lock_verbose() {
-  return variable_get('content_lock_admin_verbose', true);
+  return variable_get('content_lock_admin_verbose', TRUE);
 }
 
 function _content_lock_add_cancelbutton(&$form, $form_state, $form_id) {
@@ -377,7 +377,7 @@ function content_lock_lock_owner($lock) {
 }
 
 /**
- * Implement hook_user_logout().
+ * Implements hook_user_logout().
  */
 function content_lock_user_logout($account) {
   // removing all locks, as the user logs out
@@ -409,21 +409,21 @@ function content_lock_node($nid, $uid, $quiet = FALSE) {
     }
 
     if (isset($url)) {
-      $message .= '<br />'. t('Click !here to check back in now.', array('!here' => l(t('here'), $url, array('query' => array('destination' => $_GET['q'])))));
+      $message .= '<br />' . t('Click !here to check back in now.', array('!here' => l(t('here'), $url, array('query' => array('destination' => $_GET['q'])))));
     }
-    if(!empty($message)) {
-      drupal_set_message($message, 'warning', FALSE);
+    if (!empty($message)) {
+      drupal_set_message(filter_xss($message), 'warning', FALSE);
     }
     return FALSE;
   }
   else {
     // no lock yet, create one
-    if($lock == false) {
+    if ($lock == FALSE) {
       // Lock node.
       $data = array(
         'nid' => $nid,
         'uid' => $uid,
-        'timestamp' => time(),
+        'timestamp' => REQUEST_TIME,
         'ajax_key' => rand(),
       );
       drupal_write_record(
@@ -431,11 +431,12 @@ function content_lock_node($nid, $uid, $quiet = FALSE) {
         $data
       );
 
-      if(_content_lock_verbose() && !$quiet) {
+      if (_content_lock_verbose() && !$quiet) {
         drupal_set_message(t('This document is now locked against simultaneous editing. It will unlock when you navigate elsewhere.'), 'status', FALSE);
       }
       module_invoke_all('content_lock_locked', $nid, $uid);
-    } else {
+    }
+    else {
       /* A lock already exists: update its AJAX key */
       $lock->ajax_key = rand();
       if (!drupal_write_record('content_lock', $lock, array('nid'))) {
@@ -495,7 +496,7 @@ function content_lock_overview($account = NULL) {
     $uid = $account->uid;
   }
   $header[] = array('data' => t('Locked since'), 'field' => 'c.timestamp');
-  if($uid == $user->uid || user_access('administer checked out documents')) {
+  if ($uid == $user->uid || user_access('administer checked out documents')) {
     $header[] = t('Operations');
   }
 
@@ -506,20 +507,21 @@ function content_lock_overview($account = NULL) {
   $query->fields($n, array('title'));
   $u = $query->join('users', 'u', '%alias.uid = c.uid');
   $query->fields($u, array('name'));
-  if ($uid)
+  if ($uid) {
     $query->condition('c.uid', $uid);
+  }
   $query->orderByHeader($header);
 
   $rows = array();
   foreach ($query->execute() as $data) {
-    $url = $uid ? "admin/content/".$data->nid."/content_lock/releaseown" : 'admin/content/content_lock/release/'.$data->nid;
+    $url = $uid ? "admin/content/" . $data->nid . "/content_lock/releaseown" : 'admin/content/content_lock/release/' . $data->nid;
     $row = array();
     $row[] = l($data->title, "node/$data->nid");
     if (!$uid) {
       $row[] = theme('username', array('account' => user_load($data->uid)));
     }
     $row[] = format_date($data->timestamp, 'small');
-    if($uid == $user->uid || user_access('administer checked out documents')) {
+    if ($uid == $user->uid || user_access('administer checked out documents')) {
       $row[] = l(t('release lock'), $url);
     }
     $rows[] = $row;
@@ -544,8 +546,8 @@ function content_lock_overview($account = NULL) {
  */
 function content_lock_release_item($nid, $account = NULL) {
   content_lock_release($nid, $account ? $account->uid : NULL);
-  if(_content_lock_verbose()) {
-    drupal_set_message(t('The editing lock has been released.'),'status', FALSE);
+  if (_content_lock_verbose()) {
+    drupal_set_message(t('The editing lock has been released.'), 'status', FALSE);
   }
   drupal_goto($account ? "user/{$account->uid}/content_lock" : 'admin/content/content_lock');
 }
@@ -553,17 +555,16 @@ function content_lock_release_item($nid, $account = NULL) {
 /**
  * For every lock a user current have on any nodes, print a warning messagt
  * with an link to release this node.
- *
  */
 function content_lock_warn_pending_locks($uid) {
   // cache
   static $warned_nodes = array();
-  static $content_lock_messages_printed = false;
-  if($content_lock_messages_printed) {
+  static $content_lock_messages_printed = FALSE;
+  if ($content_lock_messages_printed) {
     return;
   }
 
-  if(array_key_exists($uid,$warned_nodes)){
+  if (array_key_exists($uid, $warned_nodes)) {
     // do nothing
   }
   else {
@@ -580,24 +581,24 @@ function content_lock_warn_pending_locks($uid) {
     }
   }
 
-  foreach($warned_nodes[$uid] as $lock) {
-    $nodetitle_link = l($lock->title,"node/{$lock->nid}");
-    $releasethelock_link = l(t('release the lock'),"admin/content/{$lock->nid}/content_lock/releaseown");
-    _content_lock_save_lock_warning(t("The node '!nodetitle_link' is locked by you. You may want to '!releasethelock_link' in order to allow others to edit.", array ('!nodetitle_link' => $nodetitle_link, '!releasethelock_link' => $releasethelock_link)),$lock->nid);
+  foreach ($warned_nodes[$uid] as $lock) {
+    $nodetitle_link = l($lock->title, "node/{$lock->nid}");
+    $releasethelock_link = l(t('release the lock'), "admin/content/{$lock->nid}/content_lock/releaseown");
+    _content_lock_save_lock_warning(t("The node '!nodetitle_link' is locked by you. You may want to '!releasethelock_link' in order to allow others to edit.", array('!nodetitle_link' => $nodetitle_link, '!releasethelock_link' => $releasethelock_link)), $lock->nid);
   }
-  $content_lock_messages_printed = true;
+  $content_lock_messages_printed = TRUE;
 }
 
 function _content_lock_save_lock_warning($message, $nid) {
-  if(empty($_SESSION['content_lock'])) {
+  if (empty($_SESSION['content_lock'])) {
     $_SESSION['content_lock'] = '';
   }
   $data = unserialize($_SESSION['content_lock']);
-  if(!is_array($data)) {
+  if (!is_array($data)) {
     $data = array();
   }
 
-  if(array_key_exists($nid,$data)) {
+  if (array_key_exists($nid, $data)) {
     return;
   }
 
@@ -607,22 +608,22 @@ function _content_lock_save_lock_warning($message, $nid) {
 
 function _content_lock_show_warnings() {
   global $user;
-  if(empty($_SESSION['content_lock'])) {
+  if (empty($_SESSION['content_lock'])) {
     return;
   }
   $data = unserialize($_SESSION['content_lock']);
-  if(!is_array($data) || count($data) == 0) {
+  if (!is_array($data) || count($data) == 0) {
     return;
   }
-  foreach($data as $nid => $messsage) {
-    if(_content_lock_still_locked($user->uid,$nid) > 0){
-      drupal_set_message($messsage,'warning', FALSE);
+  foreach ($data as $nid => $messsage) {
+    if (_content_lock_still_locked($user->uid, $nid) > 0) {
+      drupal_set_message(filter_xss($messsage), 'warning', FALSE);
     }
   }
   $_SESSION['content_lock'] = '';
 }
 
-function _content_lock_still_locked($uid,$nid) {
+function _content_lock_still_locked($uid, $nid) {
   $query = db_select('content_lock', 'c')
     ->condition('nid', $nid)
     ->condition('uid', $uid)
@@ -646,23 +647,23 @@ function _content_lock_still_locked($uid,$nid) {
  *   detect that the soon-to-come ajax request is from the previous
  *   page load and that it should be ignored.
  */
-function content_lock_release_own_item($nid, $response = true) {
+function content_lock_release_own_item($nid, $response = TRUE) {
   global $user;
 
-  if($nid != NULL) {
+  if ($nid != NULL) {
     if (!$response) {
       $lock = content_lock_fetch_lock($nid);
       if (strcmp($_GET['k'], $lock->ajax_key)) {
         /* the key doesn't match, don't unlock the node */
         if ($response) {
-          drupal_set_message('Trounced AJAX unlock request.', 'status', FALSE);
+          drupal_set_message(t('Trounced AJAX unlock request.'), 'status', FALSE);
         }
         exit();
       }
     }
-    content_lock_release($nid,$user->uid);
-   // drupal_get_messages();
-    if($response) {
+    content_lock_release($nid, $user->uid);
+    // drupal_get_messages();
+    if ($response) {
       drupal_goto("node/$nid");
     }
     else {
@@ -670,7 +671,7 @@ function content_lock_release_own_item($nid, $response = true) {
     }
   }
   else { // thats what we do, if a user was creating a node and canceled
-    if($response) {
+    if ($response) {
       drupal_goto();
     }
     else {
@@ -721,6 +722,9 @@ function content_lock_content_lock_node_lockable($node) {
   return $lockable[$format][$node->nid];
 }
 
+/**
+ * Implements hook_views_api().
+ */
 function content_lock_views_api() {
   return array(
    'api' => 2.0,
diff --git a/js/content_lock_init.js b/js/content_lock_init.js
index 7bd84c5..1281c47 100644
--- a/js/content_lock_init.js
+++ b/js/content_lock_init.js
@@ -3,22 +3,23 @@
  *   Initialize onUnload scripts.
  */
 
+(function ($) {
 Drupal.behaviors.content_lock = {
   attach: function(context) {
-  window.content_lock_onleave = function  () {
-    var nid = Drupal.settings.content_lock.nid;
-    var ajax_key = Drupal.settings.content_lock.ajax_key;
-    jQuery.ajax({
-      url: Drupal.settings.basePath + 'ajax/content_lock/'+nid+'/canceledit',
-      data: {k: ajax_key},
-      async: false,
-      cache: false
-    });
-  }
+    window.content_lock_onleave = function() {
+      var nid = Drupal.settings.content_lock.nid;
+      var ajax_key = Drupal.settings.content_lock.ajax_key;
+      jQuery.ajax({
+        url: Drupal.settings.basePath + 'ajax/content_lock/' + nid + '/canceledit',
+        data: {k: ajax_key},
+        async: false,
+        cache: false
+      });
+    };
 
-  window.content_lock_confirm = function () {
-    return Drupal.t(Drupal.settings.content_lock.unload_js_message);
-  }
+    window.content_lock_confirm = function() {
+      return Drupal.t(Drupal.settings.content_lock.unload_js_message);
+    };
 
     jQuery().onUserExit( {
       execute: content_lock_onleave,
@@ -27,3 +28,4 @@ Drupal.behaviors.content_lock = {
     });
   }
 };
+})(jQuery);
\ No newline at end of file
diff --git a/modules/content_lock_timeout/content_lock_timeout.install b/modules/content_lock_timeout/content_lock_timeout.install
index 0ec7037..a067748 100644
--- a/modules/content_lock_timeout/content_lock_timeout.install
+++ b/modules/content_lock_timeout/content_lock_timeout.install
@@ -6,7 +6,7 @@
  */
 
 /**
- * Implementation of hook_uninstall().
+ * Implementats hook_uninstall().
  */
 function content_lock_timeout_uninstall() {
   variable_del('content_lock_timeout_minutes');
diff --git a/views/content_lock.views.inc b/views/content_lock.views.inc
index 8c1554d..0a4d568 100644
--- a/views/content_lock.views.inc
+++ b/views/content_lock.views.inc
@@ -3,14 +3,14 @@
 /**
  * @file
  * This file handles views api definitions.
- * We describe the table to Views module 
+ * We describe the table to Views module
  * as well as other necessary stuff to integrate
  */
 
 /**
- * Implementation of hook_views_data()
- */ 
-function content_lock_views_data(){
+ * Implements hook_views_data().
+ */
+function content_lock_views_data() {
   $data = array();
 
   // Our group in Views UI
@@ -49,7 +49,7 @@ function content_lock_views_data(){
       'skip base' => array('user'),
     ),
   );
-  
+
   // Our Handlers:
   $data['content_lock']['persistent'] = array(
     'title' => t('Is persistent'),
@@ -102,9 +102,9 @@ function content_lock_views_data(){
 }
 
 /**
- * Implementation of hook_views_handlers()
- */ 
-function content_lock_views_handlers(){
+ * Implements hook_views_handlers().
+ */
+function content_lock_views_handlers() {
   return array(
     'info' => array(
       'path' => drupal_get_path('module', 'content_lock') . '/views',
