diff --git a/public/js/demo/vc.html b/public/js/demo/vc.html
index 853d07e..c971dd7 100644
--- a/public/js/demo/vc.html
+++ b/public/js/demo/vc.html
@@ -5,6 +5,14 @@
     <meta charset="utf-8" />
     <script src="../src/vc.js"></script>
     <link href="../../css/vc.css" rel="stylesheet" type="text/css"></link>
+    <style type="text/css" rel="stylesheet">
+.info {
+  background-color:white;
+  color: black;
+  padding: 1em;
+  font-family: mono;
+}
+    </style>
   </head>
   <body>
     <div id="vc"></div>
@@ -65,9 +73,21 @@
       document.getElementById("json").innerHTML = JSON.stringify(vc.root().toJson());
     };
 
+    function showString() {
+      document.getElementById("string").innerHTML = vc.root().toString();
+    };
+
     </script>
 
+    <hr />
+
     <p><a onclick="showJSON()" style="cursor:pointer">show JSON!</a></p>
-    <div id="json" style="background-color:white; color: black; padding: 1em; font-family: mono;"></div>
+    <div id="json" class="info"></div>
+
+    <hr />
+
+    <p><a onclick="showString()" style="cursor:pointer">show String!</a></p>
+    <div id="string" class="info"></div>
+
   </body>
 </html>
diff --git a/public/js/spec/vcSpec.js b/public/js/spec/vcSpec.js
index 4223e46..c532d32 100644
--- a/public/js/spec/vcSpec.js
+++ b/public/js/spec/vcSpec.js
@@ -461,12 +461,14 @@
 
 describe('KorAP.UnspecifiedDoc', function () {
   it('should be initializable', function () {
-    var docElement = KorAP.UnspecifiedDoc.create().element();
+    var doc = KorAP.UnspecifiedDoc.create();
+    var docElement = doc.element();
     expect(docElement.getAttribute('class')).toEqual('unspecified');
     expect(docElement.firstChild.firstChild.data).toEqual('⋯');
     expect(docElement.lastChild.getAttribute('class')).toEqual('operators');
+    expect(doc.toString()).toEqual('⋯');
 
-    // Not removable
+    // Only removable
     expect(docElement.lastChild.children.length).toEqual(0);
   });
 
@@ -872,7 +874,6 @@
     expect(vc.toString()).toEqual(
       'pubDate since 2014-05-12 & pubDate until 2014-12-05'
     );
-
   });
 
   it('should be modifiable by deletion in nested docGroups (resolve group case)', function () {
diff --git a/public/js/src/vc.js b/public/js/src/vc.js
index 6cb3925..03911ce 100644
--- a/public/js/src/vc.js
+++ b/public/js/src/vc.js
@@ -46,9 +46,8 @@
 
   function _removeChildren (node) {
     // Remove everything underneath
-    while (node.firstChild) {
+    while (node.firstChild)
       node.removeChild(node.firstChild);
-    };
   };
 
   KorAP.VirtualCollection = {
@@ -87,12 +86,26 @@
     },
     root : function (obj) {
       if (arguments.length === 1) {
-console.log("Set vc root to " + obj.toString());
+	var e = this.element();
+	if (e.firstChild !== null) {
+	  if (e.firstChild !== obj.element())
+	    e.replaceChild(obj.element(), e.firstChild);
+	}
+
+	// Append root element
+	else {
+	  e.appendChild(obj.element());
+	};
+
+	// Update parent child relations
 	this._root = obj;
+	obj.parent(this);
+
 	this.update();
       };
       return this._root;
     },
+
     element : function () {
       if (this._element !== undefined)
 	return this._element;
@@ -100,6 +113,9 @@
       this._element = document.createElement('div');
       this._element.setAttribute('class', 'vc');
 
+      // Initialize root
+      this._element.appendChild(this._root.element());
+
       return this._element;
     },
     toJson : function () {
@@ -109,11 +125,7 @@
       return this._root.toString();
     },
     update : function () {
-      var e = this.element();
-      if (e.firstChild !== null)
-	e.replaceChild(this._root.element(), e.firstChild);
-      else
-	e.appendChild(this._root.element());
+      this._root.update();
     }
   };
 
@@ -128,7 +140,6 @@
   KorAP._delete = function (e) {
     var obj = this.parentNode.refTo;
     obj.parent().delOperand(obj).update();
-    // Todo: CLEAR ALL THE THINGS!
   };
 
   /**
@@ -143,7 +154,6 @@
       return op;
     },
     update : function () {
-
       // Init the element
       if (this._element === undefined)
 	return this.element();
@@ -160,7 +170,9 @@
 	var andE = document.createElement('span');
 	andE.setAttribute('class', 'and');
 	andE.addEventListener('click', KorAP._and, false);
-	andE.appendChild(document.createTextNode(KorAP.Locale.AND));
+	andE.appendChild(
+	  document.createTextNode(KorAP.Locale.AND)
+	);
 	op.appendChild(andE);
       };
 
@@ -229,15 +241,19 @@
   KorAP.UnspecifiedDoc = {
     _ldType : "doc",
     create : function (parent) {
-      var obj = Object.create(KorAP.JsonLD).upgradeTo(KorAP.UnspecifiedDoc);
+      var obj = Object.create(KorAP.JsonLD).
+	upgradeTo(KorAP.UnspecifiedDoc);
+
       if (parent !== undefined)
 	obj._parent = parent;
+
       return obj;
     },
     update : function () {
       if (this._element === undefined)
 	return this.element();
 
+      // Remove element content
       _removeChildren(this._element);
 
       var ellipsis = document.createElement('span');
@@ -249,7 +265,8 @@
 	false,
 	false,
 	// No delete object, if this is the root
-	(this._parent !== undefined && this.parent().ldType() !== null) ? true : false
+	(this._parent !== undefined &&
+	 this.parent().ldType() !== null) ? true : false
       );
 
       this._element.appendChild(
@@ -279,9 +296,15 @@
     _obj : function () { return KorAP.Doc; },
 
     create : function (parent, json) {
-      var obj = Object(KorAP.JsonLD).create().upgradeTo(KorAP.Doc).fromJson(json);
+      var obj = Object(KorAP.JsonLD).
+	create().
+	upgradeTo(KorAP.Doc).
+	fromJson(json);
+
       if (parent !== undefined)
 	obj._parent = parent;
+
+      obj._changed = true;
       return obj;
     },
 
@@ -289,36 +312,59 @@
       if (this._element === undefined)
 	return this.element();
 
-      // Added key
-      var key = document.createElement('span');
-      key.setAttribute('class', 'key');
-      if (this.key())
-	key.appendChild(document.createTextNode(this.key()));
-
-      // Added match operator
-      var matchop = document.createElement('span');
-      matchop.setAttribute('data-type', this.type());
-      matchop.setAttribute('class', 'match');
-      matchop.appendChild(document.createTextNode(this.matchop()));
-
-      // Added match operator
-      var value = document.createElement('span');
-      value.setAttribute('data-type', this.type());
-      value.setAttribute('class', 'value');
-      if (this.value())
-	value.appendChild(document.createTextNode(this.value()));
-
+      // Get element
       var e = this._element;
 
-      // Add spans
-      e.appendChild(key);
-      e.appendChild(matchop);
-      e.appendChild(value);
+      // Check if there is a change
+      if (this._changed) {
 
-      // Set operators
-      var op = this.operators(true, true, true);
+	// Added key
+	var key = document.createElement('span');
+	key.setAttribute('class', 'key');
+	if (this.key())
+	  key.appendChild(document.createTextNode(this.key()));
 
-      e.appendChild(op.element());
+	// Added match operator
+	var matchop = document.createElement('span');
+	matchop.setAttribute('data-type', this.type());
+	matchop.setAttribute('class', 'match');
+	matchop.appendChild(
+	  document.createTextNode(this.matchop())
+	);
+
+	// Added match operator
+	var value = document.createElement('span');
+	value.setAttribute('data-type', this.type());
+	value.setAttribute('class', 'value');
+	if (this.value())
+	  value.appendChild(
+	    document.createTextNode(this.value())
+	  );
+
+	// Remove all element children
+	_removeChildren(e);
+
+	// Add spans
+	e.appendChild(key);
+	e.appendChild(matchop);
+	e.appendChild(value);
+
+	this._changed = false;
+      };
+
+      if (this._parent !== undefined) {
+	// Set operators
+	var op = this.operators(
+	  true,
+	  true,
+	  // No delete object, if this is the root
+	  (this._parent !== undefined &&
+	   this.parent().ldType() !== null) ? true : false
+	);
+
+	// Append new operators
+	e.appendChild(op.element());
+      };
 
       return e;
     },
@@ -453,23 +499,31 @@
       return this;
     },
     key : function (value) {
-      if (arguments.length === 1)
+      if (arguments.length === 1) {
 	this._key = value;
+	this._changed = true;
+      };
       return this._key;
     },
     matchop : function (match) {
-      if (arguments.length === 1)
+      if (arguments.length === 1) {
 	this._matchop = match.replace(/^match:/, '');
+	this._changed = true;
+      };
       return this._matchop || "eq";
     },
     type : function (type) {
-      if (arguments.length === 1)
+      if (arguments.length === 1) {
 	this._type = type;
+	this._changed = true;
+      };
       return this._type || "string";
     },
     value : function (value) {
-      if (arguments.length === 1)
+      if (arguments.length === 1) {
 	this._value = value;
+	this._changed = true;
+      };
       return this._value;
     },
     toJson : function () {
@@ -593,27 +647,26 @@
       };
     },
     update : function () {
-
-      console.log("Update");
-
       // There is only one operand in group
       if (this._operands.length === 1) {
 	var parent = this.parent();
 	var op = this.getOperand(0);
 
-	console.log("There is only one operand left in the group");
+	// This will prevent destruction of
+	// the operand
+	this._operands = [];
 
 	// Parent is a group
 	if (parent.ldType() !== null) {
-	  console.log("The group is not directly below root");
 	  return parent.replaceOperand(this, op).update();
 	}
 
-	// Parent is vc root
+	// Parent is vc
 	else {
-	  console.log("The group is directly below root");
-	  parent.root(op);
 	  this.destroy();
+	  // Cyclic madness
+	  parent.root(op);
+	  op.parent(parent);
 	  return parent.root();
 	};
       };
@@ -686,11 +739,13 @@
 	  // Just insert a doc
 	  if (newOp.ldType() === "doc") {
 	    this._operands[i] = newOp;
+	    newOp.parent(this);
 	  }
 	  // Insert a group of a different operation
 	  // (i.e. "and" in "or"/"or" in "and")
 	  else if (newOp.operation() != this.operation()) {
 	    this._operands[i] = newOp;
+	    newOp.parent(this);
 	  }
 
 	  // Flatten the group
@@ -699,8 +754,13 @@
 	    this._operands.splice(i, 1);
 
 	    // Inject new operands
-	    for (var op in newOp.operands().reverse())
-	      this._operands.splice(i, 0, newOp.getOperand(op))
+	    for (var op in newOp.operands().reverse()) {
+	      this._operands.splice(i, 0, newOp.getOperand(op));
+	      newOp.getOperand(0).parent(this);
+	    };
+	    // Prevent destruction of operands
+	    newOp._operands = [];
+	    newOp.destroy();
 	  };
 	  oldOp.destroy();
 	  return this;
@@ -714,15 +774,12 @@
       for (var i in this._operands) {
 	if (this._operands[i] === obj) {
 
-	  console.log("Deleted operand " + i);
-
+	  // Delete identified operand
 	  this._operands.splice(i,1);
 
 	  // Destroy object for cyclic references
 	  obj.destroy();
 
-	  // Todo: Update has to check
-	  // that this may mean the group is empty etc.
 	  return this;
 	};
       };
@@ -788,6 +845,8 @@
 
   // Abstract JsonLD object
   KorAP.JsonLD = {
+    _changed : false,
+
     create : function () {
       return Object.create(KorAP.JsonLD);
     },
@@ -802,14 +861,18 @@
       };
       return this;
     },
+
     ldType : function (type) {
       if (arguments.length === 1)
 	this._ldType = type;
       return this._ldType;
     },
+
     parent : function (obj) {
-      if (arguments.length === 1)
+      if (arguments.length === 1) {
 	this._parent = obj;
+	this._changed = true;
+      };
       return this._parent;
     },
 
@@ -844,11 +907,15 @@
       this._ops.parent(this);
       return this._ops;
     },
+
     toJson : function () {
       return {
 	// Unspecified object
 	"@type" : "korap:" + this.ldType()
       };
+    },
+    toString : function () {
+      return loc.EMPTY;
     }
   };
  
