diff --git a/revive.js b/revive.js
index <HASH>..<HASH> 100644
--- a/revive.js
+++ b/revive.js
@@ -2,30 +2,41 @@ var createKey = require('./createKey'),
     keyKey = createKey(-1);
 
 function revive(input){
-        objects = {};
+    var objects = {},
         scannedObjects = [];
 
     function scan(input){
+        var output = input;
+
+        if(typeof output !== 'object'){
+            return output;
+        }
+
+        output = input instanceof Array ? [] : {};
+
         if(input[keyKey]){
-            objects[input[keyKey]] = input;
-            delete input[keyKey];
+            objects[input[keyKey]] = output;
         }
 
         for(var key in input){
             var value = input[key];
 
+            if(key === keyKey){
+                continue;
+            }
+
             if(value != null && typeof value === 'object'){
                 if(scannedObjects.indexOf(value)<0){
                     scannedObjects.push(value);
-                    scan(value);
+                    output[key] = scan(value);
                 }
-            }
-
-            if(typeof value === 'string' && value.length === 1 && value.charCodeAt(0) > keyKey.charCodeAt(0)){
-                input[key] = objects[value];
+            }else if(typeof value === 'string' && value.length === 1 && value.charCodeAt(0) > keyKey.charCodeAt(0)){
+                output[key] = objects[value];
+            }else{
+                output[key] = input[key];
             }
         }
-        return input;
+        return output;
     }
 
     return scan(input);
reviver is non-destuctive