diff --git a/prev_next.module b/prev_next.module
index 610d285..27a9194 100644
--- a/prev_next.module
+++ b/prev_next.module
@@ -19,6 +19,11 @@ function prev_next_menu() {
     'page arguments' => array('prev_next_admin'),
     'access arguments' => array('access administration pages'),
   );
+  
+  $items['admin/config/system/prev_next/settings'] = array(
+    'title' => 'Settings',
+    'type' => MENU_DEFAULT_LOCAL_TASK,
+  );
 
   $items['admin/config/system/prev_next/re-index'] = array(
     'type' => MENU_CALLBACK,
diff --git a/prev_next_views.module b/prev_next_views.module
index 8104741..11bdde7 100644
--- a/prev_next_views.module
+++ b/prev_next_views.module
@@ -31,10 +31,15 @@ function prev_next_views_prev_next_nid($nid, $op = 'next') {
 
 
 /**
- * Implements hook_perm().
+ * Implements hook_permission().
  */
-function prev_next_views_perm() {
-  return array('administer prev_next_views');
+function prev_next_views_permission() {
+  return array(
+    'administer prev_next_views' => array(
+      'title' => t('Administer Prev/Next for Views'),
+      'description' => t('Perform administration tasks for Prev/Next for Views module.'),
+    ),
+  );
 }
 
 
@@ -44,7 +49,7 @@ function prev_next_views_perm() {
 function prev_next_views_menu() {
   $items = array();
 
-  $items['admin/config/prev_next/views'] = array(
+  $items['admin/config/system/prev_next/views'] = array(
     'title' => 'Views',
     'page callback' => 'drupal_get_form',
     'page arguments' => array('prev_next_views_settings'),
@@ -59,16 +64,21 @@ function prev_next_views_menu() {
 
 
 /**
- * Implements hook_nodeapi().
+ * Implements hook_node_load().
  */
-function prev_next_views_nodeapi(&$node, $op) {
-  if (isset($_SESSION['prev_next_views']) && (array_search($node->nid, $_SESSION['prev_next_views']) === FALSE)) {
-    // The current node is no longer part of the views results, so forget about it
-    unset($_SESSION['prev_next_views']);
+function prev_next_views_node_load($nodes, $types) {
+  if (isset($_SESSION['prev_next_views'])) {
+    foreach ($nodes as $node) {
+      if (array_search($node->nid, $_SESSION['prev_next_views']) === FALSE) {
+        // The node being loaded is no longer part of the views results, so forget about it
+        unset($_SESSION['prev_next_views']);
+      }
+    }
   }
 }
 
 
+
 /**
  * Implements hook_views_api().
  */
@@ -84,14 +94,11 @@ function prev_next_views_views_api() {
  */
 function prev_next_views_views_pre_execute(&$view) {
   if (in_array($view->name, variable_get('prev_next_views_enabled', array()))) {
-    $query = db_rewrite_sql($view->build_info['query'], $view->base_table, $view->base_field, array('view' => &$view));
-    $args = $view->build_info['query_args'];
+    $result = $view->build_info['query']->execute();
 
-    // TODO Please convert this statement to the D7 database API syntax.
-    $result = db_query($query, $args);
     $nids = array();
-    while ($item = db_fetch_array($result)) {
-      $nids[] = $item['nid'];
+    foreach ($result as $item) {
+      $nids[] = $item->nid;
     }
 
     $_SESSION['prev_next_views'] = $nids;
