diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..53a5344
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+/nbproject
diff --git a/views/views_exclude_previous.views.inc b/views/views_exclude_previous.views.inc
new file mode 100644
index 0000000..a6b8410
--- /dev/null
+++ b/views/views_exclude_previous.views.inc
@@ -0,0 +1,48 @@
+<?php
+
+/**
+ * @file
+ * Views functions for views exclude previous.
+ */
+
+/**
+ * Implements hook_views_data_alter()
+ */
+function views_exclude_previous_views_data_alter(&$data) {
+  $data['node']['views_exclude_previous'] = array(
+    'group' => t('Views'),
+    'title' => t('Views Exclude Previous'),
+    'help' => t('Excludes nodes that have already been loaded/viewed in the current page.'),
+    'filter' => array(
+      'handler' => 'views_exclude_previous_handler_filter',
+    ),
+  );
+}
+
+/**
+ * Implements hook_views_handlers
+ */
+function views_exclude_previous_views_handlers() {
+  return array(
+    'info' => array(
+      'path' => drupal_get_path('module', 'views_exclude_previous'),
+    ),
+    'handlers' => array(
+      'views_exclude_previous_handler_filter' => array(
+        'parent' => 'views_handler_filter_in_operator',
+      ),
+    ),
+  );
+}
+/**
+ * Implements hook_views_post_execute().
+ */
+function views_exclude_previous_views_post_execute($view) {
+  if ($view->base_table === 'node') {
+    foreach ($view->result AS $result) {
+      if (!empty($result->nid)) {
+        _views_exclude_previous('views', $result->nid);
+      }
+    }
+  }
+}
diff --git a/views/views_exclude_previous_handler_filter.inc b/views/views_exclude_previous_handler_filter.inc
new file mode 100644
index 0000000..74de599
--- /dev/null
+++ b/views/views_exclude_previous_handler_filter.inc
@@ -0,0 +1,53 @@
+<?php
+/**
+ * @file
+ *  Class definition of views_exclude_previous_handler_filter.
+ */
+class views_exclude_previous_handler_filter extends views_handler_filter_in_operator {
+
+  function get_value_options() {
+    // @todo: Make this pluggable.
+    $this->value_options = array(
+      'node_load' => 'Exclude nodes previously loaded (hook_node_load).',
+      'node_view' => 'Exclude nodes previously viewd (hook_node_view).',
+      'views' => 'Exclude nodes that where loaded in any node based view.',
+    );
+  }
+
+  function option_definition() {
+    $options = parent::option_definition();
+
+    $options['operator']['default'] = 'not in';
+    $options['value']['default'] = array();
+
+    return $options;
+  }
+
+  /**
+   * Provide inclusive/exclusive matching
+   */
+  function operator_options() {
+    return array(
+      'not in' => t('Is not in'),
+    );
+  }
+
+  function query() {
+    $alias = $this->query->ensure_table('node');
+    if (!$alias) {
+      return;
+    }
+    if (!$this->value) {
+      return;
+    }
+    $excludes = array();
+    foreach ($this->value AS $category) {
+      $excludes += _views_exclude_previous($category);
+    }
+
+    if (!empty($excludes)) {
+      $this->query->add_where($this->options['group'], $alias . '.nid', $excludes, 'NOT IN');
+    }
+  }
+
+}
diff --git a/views_exclude_previous.info b/views_exclude_previous.info
index 30a5a71..f9cb87b 100644
--- a/views_exclude_previous.info
+++ b/views_exclude_previous.info
@@ -2,5 +2,5 @@ name = "Views Exclude Previous"
 description = "Views Exclude Previous provides a views filter which exlcudes nodes that have already been loaded/displayed on the current page."
 dependencies[] = views
 package = Views
-core = 6.x
-
+core = 7.x
+files[] = views/views_exclude_previous_handler_filter.inc
diff --git a/views_exclude_previous.module b/views_exclude_previous.module
index 75df702..e21e5cb 100644
--- a/views_exclude_previous.module
+++ b/views_exclude_previous.module
@@ -1,7 +1,12 @@
 <?php
 
 /**
- * Implementation of hook_help().
+ * @file
+ * Main file of the views exclude previous module.
+ */
+
+/**
+ * Implements hook_help().
  */
 function views_exclude_previous_help($section, $arg) {
   switch ($section) {
@@ -11,88 +16,50 @@ function views_exclude_previous_help($section, $arg) {
 }
 
 /**
- * Implementation of theme_registry_alter. 
- * 
- * We use this to hook into view's
- * themeing function, so we can register nodes that are prepared for displaying
- * by the views module.
- *
+ * Implements hook_views_api().
  */
-function views_exclude_previous_theme_registry_alter(&$cache) {
-  foreach ($cache as $k => $v) {
-    if (preg_match('/^views_view_fields(__.*)?$/', $k)) {
-      $cache[$k]['preprocess functions'][] = 'views_exclude_previous_process_fields';
-    } else if (preg_match('/^views_view_table(__.*)?$/', $k)) {
-      $cache[$k]['preprocess functions'][] = 'views_exclude_previous_process_table';
-    }
-  }
-}
-
-/**
- * This called for every row that is themed by the views module
- */
-function views_exclude_previous_process_fields($var) {
-  _views_exclude_previous('viewed_row', $var['row']->nid);
-}
-
-/**
- * This called for tables themed by the views module
- */
-function views_exclude_previous_process_table($var) {
-  foreach($var['view']->result as $row) {
-    _views_exclude_previous('viewed_table', $row->nid);
-  }
+function views_exclude_previous_views_api() {
+  return array(
+    'api' => '3.0',
+    'path' => drupal_get_path('module', 'views_exclude_previous') . '/views',
+  );
 }
 
-
 /**
- * Implementation of hook_nodeapi
- *
- * We use this to track nodes that are loaded/prepared for viewing
+ * Implements hook_node_load().
  */
-function views_exclude_previous_nodeapi(&$node, $op, $a3 = null, $a4 = null) {
-  if ($op == 'load') {
-    _views_exclude_previous('loaded', $node->nid);
-  } else if ($op == 'view') {
-    _views_exclude_previous('viewed_nodeapi', $node->nid);
+function views_exclude_previous_node_load($nodes, $types) {
+  foreach ($nodes AS $nid => $node) {
+    _views_exclude_previous('node_load', $nid);
   }
 }
 
 /**
- * Implementation of hook_views_api
+ * Implements hook_node_view().
  */
-function views_exclude_previous_views_api() {
-  return array(
-    'api' => '2.0',
-    'path' => drupal_get_path('module', 'views_exclude_previous'),
-  );
+function views_exclude_previous_node_view($node, $view_mode, $langcode) {
+  _views_exclude_previous('node_view', $node->nid);
 }
 
 /**
- * Implementation of hook_views_query_substitutions
+ * This function stores/returns nids for the given category.
+ *
+ * @staticvar array $excludes
+ *   Static storage of our excluded nids.
+ * @param $cat
+ *   A category given by the exclude plugin.
+ * @param $nid
+ *   The nid to be excluded. Optional so the function just returns the category.
+ * @return array
+ *   Always returns the given category.
  */
-function views_exclude_previous_views_query_substitutions($view) {
-  return array(
-    '***EXCLUDE_PREVIOUS_LOADED***' => implode(',', _views_exclude_previous('loaded')),
-    '***EXCLUDE_PREVIOUS_VIEWED_NODEAPI***' => implode(',', _views_exclude_previous('viewed_nodeapi')),
-    '***EXCLUDE_PREVIOUS_VIEWED_ROW***' => implode(',', _views_exclude_previous('viewed_row')),
-    '***EXCLUDE_PREVIOUS_VIEWED_TABLE***' => implode(',', _views_exclude_previous('viewed_table')),
-  );
-}
+function _views_exclude_previous($cat, $nid = NULL) {
+  $excludes = &drupal_static(__FUNCTION__);
 
-/**
- * This function stores/returns node ids for the current execution
- */
-function _views_exclude_previous($cat, $nid = null) {
-  static $nids = array();
-  
-  if (!isset($nids[$cat])) {
-    $nids[$cat] = array(0);
-  }
-  
-  if ($nid !== null) {
-    $nids[$cat][] = $nid;
+  // Add nid to be excluded in the current category.
+  if (!empty($nid)) {
+    $excludes[$cat][$nid] = $nid;
   }
-  
-  return $nids[$cat];
+
+  return !empty($excludes[$cat]) ? $excludes[$cat] : array(0);
 }
diff --git a/views_exclude_previous.views.inc b/views_exclude_previous.views.inc
deleted file mode 100644
index 78cfba7..0000000
--- a/views_exclude_previous.views.inc
+++ /dev/null
@@ -1,31 +0,0 @@
-<?php
-
-/**
- * Implementation of hook_views_data()
- */
-function views_exclude_previous_views_data_alter(&$cache) {
-  $cache['node']['views_exclude_previous'] = array(
-    'group' => t('Views'),
-    'title' => t('Views Exclude Previous'),
-    'help' => t('Excludes nodes that have already been loaded/viewed in the current page.'),
-    'filter' => array(
-      'handler' => 'views_exclude_previous_handler',
-    ),
-  );
-}
-
-/**
- * Implementation of hook_views_handlers
- */
-function views_exclude_previous_views_handlers() {
-  return array(
-    'info' => array(
-      'path' => drupal_get_path('module', 'views_exclude_previous'),
-    ),
-    'handlers' => array(
-      'views_exclude_previous_handler' => array(
-        'parent' => 'views_handler_filter_in_operator',
-      ),
-    ),
-  );
-}
diff --git a/views_exclude_previous_handler.inc b/views_exclude_previous_handler.inc
deleted file mode 100644
index 4b29473..0000000
--- a/views_exclude_previous_handler.inc
+++ /dev/null
@@ -1,55 +0,0 @@
-<?php
-class views_exclude_previous_handler extends views_handler_filter_in_operator {
-  function get_value_options() {
-    $this->value_options = array(
-      'loaded' => 'Nodes previously loaded via the nodeapi',
-      'viewed_nodeapi' => 'Nodes previously prepared for viewing via the nodeapi',
-      'viewed_row' => 'Nodes previously prepared for viewing via the views module default unformated/list/grid styles',
-      'viewed_table' => 'Nodes previously prepared for viewing via the views module default table style',
-    );
-  }
-
-  function option_definition() {
-    $options = parent::option_definition();
-
-    $options['operator']['default'] = 'not in';
-    //$options['value']['default'] = array('loaded', 'viewed_nodeapi', 'viewed_row', 'viewed_table');
-    $options['value']['default'] = array();
-
-    return $options;
-  }
-
-  /**
-   * Provide inclusive/exclusive matching
-   */
-  function operator_options() {
-    return array(
-      'not in' => t('Is not in'),
-    );
-  }
-
-  function query() {
-    $alias = $this->query->ensure_table('node');
-    if (!$alias) return;
-    if (!$this->value) return;
-    
-    $map = array(
-      'loaded' => '***EXCLUDE_PREVIOUS_LOADED***',
-      'viewed_nodeapi' => '***EXCLUDE_PREVIOUS_VIEWED_NODEAPI***',
-      'viewed_row' => '***EXCLUDE_PREVIOUS_VIEWED_ROW***',
-      'viewed_table' => '***EXCLUDE_PREVIOUS_VIEWED_TABLE***',
-    );
-    
-    $list = array();
-    foreach ($map as $k => $v) {
-      if (in_array($k, $this->value)) {
-        $list[] = $v;
-      }
-    }
-    if ($list) {
-      $list = implode(',', $list);
-      $this->query->add_where($this->options['group'], $alias.'.nid NOT IN ('.$list.')');
-    }
-  }
-}
-
