Add wrapper to root
diff --git a/public/css/vc.css b/public/css/vc.css
index 0b25c66..2b8058c 100644
--- a/public/css/vc.css
+++ b/public/css/vc.css
@@ -146,22 +146,51 @@
   z-index: 30;
 }
 
-.docGroup .docGroup > .operators {
+.docGroup
+.docGroup > .operators {
   z-index: 31;
 }
 
-.docGroup .docGroup .docGroup > .operators {
+.docGroup
+.docGroup
+.docGroup > .operators {
   z-index: 32;
 }
 
-.docGroup .docGroup .docGroup .docGroup > .operators {
+.docGroup
+.docGroup
+.docGroup
+.docGroup > .operators {
   z-index: 33;
 }
 
-.docGroup .docGroup .docGroup .docGroup .docGroup > .operators {
+.docGroup
+.docGroup
+.docGroup
+.docGroup
+.docGroup > .operators {
   z-index: 34;
 }
 
+.docGroup
+.docGroup
+.docGroup
+.docGroup
+.docGroup
+.docGroup > .operators {
+  z-index: 35;
+}
+
+.docGroup
+.docGroup
+.docGroup
+.docGroup
+.docGroup
+.docGroup
+.docGroup > .operators {
+  z-index: 36;
+}
+
 .vc .doc > span.key,
 .vc .doc > span.value {
   font-weight: bold;
diff --git a/public/js/spec/vcSpec.js b/public/js/spec/vcSpec.js
index 32a018f..4ac18a8 100644
--- a/public/js/spec/vcSpec.js
+++ b/public/js/spec/vcSpec.js
@@ -1421,7 +1421,57 @@
     expect(fc.lastChild.getAttribute('class')).toEqual('operators');
   });
 
-  // Todo: wrap on root!!
+  it ('should wrap on group (case "and")', function () {
+    var vc = complexVCFactory.create();
+
+    // Wrap with direct element access
+    expect(vc.toQuery()).toEqual(
+      'pubDate in 2014-12-05 & (title = "Hello World!" | foo = "bar")'
+    );
+
+    // Add unspecified
+    KorAP._and.bind(vc.root().getOperand(1).element().lastChild.firstChild).apply();
+    expect(vc.toQuery()).toEqual(
+      'pubDate in 2014-12-05 & (title = "Hello World!" | foo = "bar")'
+    );
+    expect(vc.root().ldType()).toEqual('docGroup');
+    expect(vc.root().getOperand(1).ldType()).toEqual('docGroup');
+    expect(vc.root().getOperand(1).operation()).toEqual('and');
+/*
+    expect(vc.root().operation()).toEqual('and');
+*/
+  });
+
+/*
+  it ('should wrap on root', function () {
+    var vc = KorAP.VirtualCollection.render(
+      {
+	"@type": 'korap:docGroup',
+	'operation' : 'operation:and',
+	'operands' : [
+	  {
+	    "@type": 'korap:doc',
+	    "key": 'pubDate',
+	    "match": 'match:eq',
+	    "value": '2014-12-05',
+	    "type": 'type:date'
+	  },
+	  {
+	    "@type" : 'korap:doc',
+	    'key' : 'foo',
+	    'value' : 'bar'
+	  }
+	]
+      }
+    );
+
+    // Delete with direct element access
+    expect(vc.toQuery()).toEqual('pubDate in 2014-12-05 & foo = "bar"');
+    KorAP._or.bind(vc.root().element().lastChild.lastChild).apply();
+    expect(vc.root().ldType()).toEqual('docGroup');
+    expect(vc.root().operation()).toEqual('or');
+  });
+*/
 });
 
 /*
diff --git a/public/js/src/vc.js b/public/js/src/vc.js
index 09d20ea..d9cde4e 100644
--- a/public/js/src/vc.js
+++ b/public/js/src/vc.js
@@ -59,17 +59,28 @@
   // Add doc
   KorAP._add = function (obj, type) {
     var ref = obj.parentNode.refTo;
+    var parent = ref.parent();
     if (ref.ldType() === 'docGroup') {
-      console.log('~~~~~~~~~');
-    }
-    else if (ref.ldType() === 'doc') {
-      var parent = ref.parent();
-// Todo: Check if parent is a group
-      if (parent.operation() === type) {
-	  parent.newAfter(ref);
+
+      // Check that the action differs from the type
+      if (ref.operation() === type)
+	return;
+
+      if (parent.ldType() !== null) {
+	return parent.newAfter(ref);
       }
       else {
-	ref.wrap(type);
+	// The group is on root - wrap
+	return ref.wrapOnRoot();
+      };
+    }
+    else if (ref.ldType() === 'doc') {
+// Todo: Check if parent is a group
+      if (parent.operation() === type) {
+	return parent.newAfter(ref);
+      }
+      else {
+	return ref.wrap(type);
       };
     };
   };
@@ -148,8 +159,11 @@
       if (arguments.length === 1) {
 	var e = this.element();
 	if (e.firstChild !== null) {
-	  if (e.firstChild !== obj.element())
+	  console.log(e.firstChild);
+	  if (e.firstChild !== obj.element()) {
+console.log(e.firstChild);
 	    e.replaceChild(obj.element(), e.firstChild);
+	  };
 	}
 
 	// Append root element
@@ -714,6 +728,22 @@
       };
     },
 
+    // Wrap a new operation around the root group element 
+    wrapOnRoot : function () {
+      var parent = this.parent();
+
+      var group = KorAP.DocGroup.create(parent);
+      group.operation(
+	this.operation() === 'and' ? 'or' : 'and'
+      );
+      group.append(this);
+      this.parent(group);
+      group.append();
+      group.element(); // Init (seems to be necessary)
+      parent.root(group);
+      return this.parent();
+    },
+
     update : function () {
       // There is only one operand in group
       if (this._operands.length === 1) {