         self.children = children
 
         super.init(name: name)
+        
+        updateParentForChildren()
     }
 
     public convenience init(type: StandardElementType, attributes: [Attribute] = [], children: [Node] = []) {
         self.init(name: type.rawValue, attributes: attributes, children: children)
+    }
+    
+    // MARK: - Children Logic
+    
+    private func updateParentForChildren() {
+        for child in children where child.parent !== self {
+            if let oldParent = child.parent,
+                let childIndex = oldParent.children.index(of: child) {
+                
+                oldParent.children.remove(at: childIndex)
+            }
+            
+            child.parent = self
+        }
     }
     
     // MARK: - Node Overrides

        return name == rhs.name && attributes == rhs.attributes && children == rhs.children
    }


    // MARK: - Initializers

    public init(name: String, attributes: [Attribute], children: [Node]) {

    public var attributes = [Attribute]()
    public var children: [Node] {
        didSet {
            updateParentForChildren()
        }
    }

