diff --git a/content_lock.admin.inc b/content_lock.admin.inc
index c7264ef..27c0ab5 100644
--- a/content_lock.admin.inc
+++ b/content_lock.admin.inc
@@ -3,8 +3,9 @@
 
 # Copyright (c) 2010 Impressive.media
 # Author: Eugen Mayer
-/*
- * Providing a administration interface for tagging.
+
+/**
+ * Providing an administration interface for content_lock.
  */
 function content_lock_admin_settings() {
   $form['content_lock_admin_verbose'] = array(
@@ -21,5 +22,27 @@ function content_lock_admin_settings() {
       '#default_value' => variable_get('content_lock_admin_cancelbutton', true),
   );
 
+  $form['content_lock_allowed_node_types'] = array(
+    '#type' => 'checkboxes',
+    '#title' => t('Lockable content types'),
+    '#description' => t('Apply lock to the selected content types. Leave blank for all.'),
+    '#options' => node_get_types('names'),
+    '#default_value' => variable_get('content_lock_allowed_node_types', array()),
+  );
+
+  $formats = filter_formats();
+  $format_options = array();
+  foreach ($formats as $id => $format) {
+    $format_options[$id] = $format->name;
+  }
+
+  $form['content_lock_allowed_formats'] = array(
+    '#type' => 'checkboxes',
+    '#title' => t('Lockable text formats'),
+    '#description' => t('Apply lock to selected formats only. Leave blank for all.'),
+    '#options' => $format_options,
+    '#default_value' => variable_get('content_lock_allowed_formats', array()),
+  );
+
   return system_settings_form($form);
-}
\ No newline at end of file
+}
diff --git a/content_lock.module b/content_lock.module
index f087c35..644cc89 100644
--- a/content_lock.module
+++ b/content_lock.module
@@ -105,7 +105,7 @@ function content_lock_nodeapi(&$node, $op, $teaser, $page) {
 
   switch ($op) {
     case 'validate':
-      if (isset($node->nid) && user_access('check out documents')) {
+      if (isset($node->nid) && _content_lock_is_lockable_node($node) && user_access('check out documents')) {
         // Existing node. Check if we still own the lock.
         if ($lock = content_lock_fetch_lock($node->nid)) {
           if ($lock->uid != $user->uid) {
@@ -122,13 +122,22 @@ function content_lock_nodeapi(&$node, $op, $teaser, $page) {
       }
       break;
     case 'update':
+      if (_content_lock_is_lockable_node($node)) {
         content_lock_release($node->nid, $user->uid);
+      }
       break;
     case 'delete':
-      content_lock_release($node->nid, NULL);
+      if (_content_lock_is_lockable_node($node)) {
+        content_lock_release($node->nid, NULL);
+      }
       break;
     case 'view':
       global $user;
+
+      if (!_content_lock_is_lockable_node($node)) {
+        break;
+      }
+
       if(!$messages_shown) {
         _content_lock_show_warnings();
         $messages_shown = true;
@@ -159,13 +168,32 @@ function content_lock_form_alter(&$form, $form_state, $form_id) {
   $node = $form['#node'];
   $nid = $form['nid']['#value'];
 
+  // _content_lock_is_lockable_node() needs to know the original
+  // node format.
+  $old_format = $node->format;
+  if (!empty($form_state['values']['content_lock_old_format'])) {
+    $old_format = $form_state['values']['content_lock_old_format'];
+  }
+  $form['content_lock_old_format'] = array(
+    '#type' => 'hidden',
+    '#value' => $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'].
+  if ($node != NULL && !empty($nid)) {
+    $node->content_lock_old_format = $old_format;
+  }
+
   if( $node_type_blacklist[$node->type] !== true  // If this node is blacklisted, dont lock
       && user_access('check out documents')       // The user must have this permission to be able to lock
       && ($node->type."_node_form" == $form_id)   // Dont lock if we are administrating the node-type
       && ($node != NULL)                          // If we somehow have no node, no need to lock at all
-      && ($user->uid > 0)                           // A valid user is needed for locking
-      && ($form_state['submitted'] === false)     // submitted: is true if we save, but false if its a preview. We dont want to try to lock and saves
+      && ($user->uid > 0)                         // A valid user is needed for locking
+      && ($form_state['submitted'] === FALSE      // Check locks and add the unload_js when first editing the node
+          || $node->build_mode == NODE_BUILD_PREVIEW) // ...or when previewing the node.
       && (!empty($nid))                           // nid: If we have no nid, we are adding a node and therefor we need not locking.
+      && _content_lock_is_lockable_node($node)    // Only process nodes configured for locking. Must be after form and null node checks.
       && $form_id != "comment_form")              // form_id: if we just got called because of adding a comment, we dont need to lock the node itself
     {
     _content_lock_add_unload_js($form);
@@ -541,3 +569,33 @@ function content_lock_release_own_item($nid, $response = true) {
     }
   }
 }
+
+/**
+ * Check whether a node is configured to be protected by content_lock.
+ */
+function _content_lock_is_lockable_node($node) {
+  static $lockable;
+
+  // To catch the case where the user is changing the input format,
+  // we store the original input format.
+  $format = $node->format;
+  if (!empty($node->content_lock_old_format)) {
+    $format = $node->content_lock_old_format;
+  }
+
+  if (isset($lockable[$format][$node->nid])) {
+    return $lockable[$format][$node->nid];
+  }
+
+  $types = array_filter(variable_get('content_lock_allowed_node_types', array()));
+  $formats = array_filter(variable_get('content_lock_allowed_formats', array()));
+
+  $lockable[$format][$node->nid] = FALSE;
+  // Determine if the node is of a lockable content type or text format.
+  if ((empty($types) || in_array($node->type, $types))
+      && (empty($formats) || in_array($format, $formats))) {
+    $lockable[$format][$node->nid] = TRUE;
+  }
+
+  return $lockable[$format][$node->nid];
+}
