@Override
	public void undo() {
		// Shorthand
		Node youngestNode = ((PrimitiveUndoableMove) primitives.get(0)).getNode();
		JoeTree tree = youngestNode.getTree();

		if (isUpdatingGui()) {
			// Store nodeToDrawFrom if neccessary. Used when the selection is dissconnected.
			OutlineLayoutManager layout = tree.getDocument().panel.layout;
			Node nodeToDrawFromTmp = layout.getNodeToDrawFrom().nextUnSelectedNode();

			// Do all the Inserts
			tree.setSelectedNodesParent(parent);

			for (int i = primitives.size() - 1; i >= 0; i--) {
				PrimitiveUndoableMove primitive = (PrimitiveUndoableMove) primitives.get(i);
				
				// ShortHand
				Node node = primitive.getNode();
				
				// Remove the Node
				tree.removeNode(node);
				targetParent.removeChild(node);

				// Insert the Node
				parent.insertChild(node, primitive.getIndex());
				tree.insertNode(node);
				
				// Set depth if neccessary.
				if (targetParent.getDepth() != parent.getDepth()) {
					node.setDepthRecursively(parent.getDepth() + 1);
				}

				// Update selection
				tree.addNodeToSelection(node);
			}

			// Record the EditingNode
			tree.setEditingNode(youngestNode);
			tree.setComponentFocus(OutlineLayoutManager.ICON);

			// Redraw and Set Focus
			if (layout.getNodeToDrawFrom().isAncestorSelected()) { // Makes sure we dont' stick at the top when multiple nodes are selected.
				Node visNode = layout.getNodeToDrawFrom().prev();
				int ioVisNode = tree.getVisibleNodes().indexOf(visNode);
				int ioNodeToDrawFromTmp = tree.getVisibleNodes().indexOf(nodeToDrawFromTmp);
				if (ioVisNode < ioNodeToDrawFromTmp) {
					layout.setNodeToDrawFrom(visNode, ioVisNode);
				} else {
					layout.setNodeToDrawFrom(nodeToDrawFromTmp, ioNodeToDrawFromTmp);
				}
			}
			
			layout.draw(tree.getYoungestInSelection(), OutlineLayoutManager.ICON);		
		} else {
			for (int i = primitives.size() - 1; i >= 0; i--) {
				PrimitiveUndoableMove primitive = (PrimitiveUndoableMove) primitives.get(i);
				
				// ShortHand
				Node node = primitive.getNode();
				
				// Remove the Node
				tree.removeNode(node);
				targetParent.removeChild(node);

				// Insert the Node
				parent.insertChild(node, primitive.getIndex());
				tree.insertNode(node);
				
				// Set depth if neccessary.
				if (targetParent.getDepth() != parent.getDepth()) {
					node.setDepthRecursively(parent.getDepth() + 1);
				}
			}		
		}
	}