diff --git a/realname.module b/realname.module
index 920cbb1..cbf1f79 100644
--- a/realname.module
+++ b/realname.module
@@ -428,64 +428,46 @@ function realname_user($op, &$edit, &$account, $category = NULL) {
  * Implements hook_nodeapi().
  */
 function realname_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
-  static $type;
-  static $accounts = array();
-  if (!user_access('use realname')) {
-    return;
-  }
-
-  // NickSI: Yes, we will have another switch later but I would like to separate table update with other processing
-  // Update the realname for the author of a content_profile node when it is edited.
-  if ( variable_get('realname_profile_module', NULL) == 'content_profile' && module_exists('content_profile') && is_content_profile($node->type)) {
-    switch ($op) {
-      case 'update':
-      case 'insert':
-      case 'delete':
-        realname_make_name(user_load($node->uid), TRUE);
-    }
-  }
-
-  if (!variable_get('realname_nodeapi', FALSE)) {
-    return;
-  }
   switch ($op) {
     case 'view':
-      // Don't operate on the node type that we are using.
-      if (!isset($type)) {
-        $type = variable_get('realname_profile_type', NULL);
-      }
-      if ($node->type == $type) {
-        break;
+      // This replaces the username with realname to fix some areas that show
+      // the username.
+      if (variable_get('realname_nodeapi', FALSE) && user_access('use realname') && $node->type != variable_get('realname_profile_type', NULL)) {
+        // Save the username that is already there.
+        $node->realname_save = $node->name;
+        $account = realname_get_user($node->uid);
+        $node->realname = $node->name = $account->name;
+        $node->homepage = isset($account->homepage) ? $account->homepage : NULL;
       }
-      // Node is being loaded.
-      // Save the username that is already there.
-      $node->realname_save = $node->name;
-      if (!isset($accounts[$node->uid])) {
-        $accounts[$node->uid] = realname_get_user($node->uid);
-      }
-      $account = $accounts[$node->uid];
-      $node->realname = $node->name = $account->name;
-      $node->homepage = isset($account->homepage) ? $account->homepage : NULL;
       break;
-
     case 'prepare':
-      // Node is about to be edited.
-      // Reset the username or save will fail.
-      if (isset($node->realname_save)) {
+      // Reset the username or wrong name will display in the author field
+      // in the node form and save will fail due to non-existant user.
+      if (variable_get('realname_nodeapi', FALSE) && isset($node->realname_save)) {
         $node->name = $node->realname_save;
       }
       break;
+    case 'update':
+    case 'insert':
+    case 'delete':
+      if (variable_get('realname_profile_type', NULL) && $node->type == variable_get('realname_profile_type', NULL)) {
+        realname_get_user($node->uid, TRUE);
+      }
+      break;
   }
 }
 
 /**
  * Helper to replace user_load() and be much faster.
  */
-function realname_get_user($uid) {
-  $result = db_query("SELECT uid, name, mail FROM {users} WHERE uid = %d", $uid);
-  $account = db_fetch_object($result);
-  $account->name = realname_make_name($account);
-  return $account;
+function realname_get_user($uid, $reset = FALSE) {
+  static $accounts;
+  if ($reset || !isset($accounts[$uid])) {
+    $account = db_fetch_object(db_query("SELECT uid, name, mail FROM {users} WHERE uid = %d", $uid));
+    $account->name = realname_make_name($account, $reset);
+    $accounts[$uid] = $account;;
+  }
+  return $accounts[$uid];
 }
 
 /**
