diff --git a/nodeaccess.module b/nodeaccess.module
index 4de877e..df29d90 100644
--- a/nodeaccess.module
+++ b/nodeaccess.module
@@ -75,9 +75,56 @@ function nodeaccess_permission() {
 /**
  * Implements hook_node_access().
  */
+function nodeaccess_node_access($node, $op, $account) {
+  switch ($op) {
+    case 'update':
+    case 'delete':
+      if (!isset($account->uid)) {
+        global $user;
+        $account = $user;
+      }
+      // If the node belongs to a deleted user.
+      if ($account->uid == 0 && $node->uid == 0) {
+        // We check if the role has particular access to this node.
+        $grants = _nodeaccess_get_grants($node);
+        // If anonymous has rights to this node, we allow them.
+        if (($grants['rid'][1]['grant_update'] && $op == 'update') ||
+            ($grants['rid'][1]['grant_delete'] && $op == 'delete')) {
+          return NODE_ACCESS_ALLOW;
+        }
+        return NODE_ACCESS_DENY;
+      }
+      break;
+
+    case 'view':
+      if (!isset($account->uid)) {
+        global $user;
+        $account = $user;
+      }
+      // If the node is not published. We check other permissions.
+      if (!$node->status) {
+        // If the current user is the author and not anonymous.
+        if ($node->uid == $account->uid && $account->uid > 0) {
+          // We check to see if they have access to view own unpublished.
+          if (user_access('view own unpublished content') || user_access('bypass node access')) {
+            return NODE_ACCESS_ALLOW;
+          }
+        }
+        elseif (user_access('bypass node access')) {
+          return NODE_ACCESS_ALLOW;
+        }
+        return NODE_ACCESS_DENY;
+      }
+      break;
+
+  }
+}
+
+/**
+ * Determine access to Grant tab.
+ */
 function nodeaccess_access($op, $node, $account = NULL) {
   global $user;
-
   if (!$node) {
     return FALSE;
   }
