     }
 
 
+    /// Returns the index corresponding to the tree node’s type in the type pop-up menu.
+    /// - parameter treeNode: The tree node whose type pop-up menu index is being returned.
     private func typePopUpMenuItemIndexOfTreeNode(treeNode: PropertyListTreeNode) -> Int {
         return treeNode.item.propertyListType.typePopUpMenuItemIndex
     }
 
 
+    /// Sets the type for the specified tree node. 
+    ///
+    /// This method works by first converting the existing property list item of the tree node
+    /// to the new type and then invoking `‑setValue:ofTreeNode:needsChildRegeneration:` with
+    /// the new value. Child regeneration is needed when the type of the given tree goes from
+    /// being a scalar to a collection or vice versa.
+    ///
+    /// - parameter key: The key being set. If the dictionary already contains this key, has no
+    ///       effect. This should not be possible because of our implementation of 
+    //        `‑control:textShouldEndEditing:`.
+    /// - parameter treeNode: The tree node whose key is being set.
     private func setType(type: PropertyListType, ofTreeNode treeNode: PropertyListTreeNode) {
         let wasCollection = treeNode.item.isCollection
-        let value = treeNode.item.propertyListItemByConvertingToType(type)
-        let isCollection = value.isCollection
-
-        // We only need child regeneration if we changed from being a scalar to a collection or vice
-        // versa.  If we changed types from one collection to another, we convert the children
-        // automatically, so we will have the right number of nodes.
-        self.setValue(value, ofTreeNode: treeNode, needsChildRegeneration: wasCollection != isCollection)
-    }
-
-
+        let newValue = treeNode.item.propertyListItemByConvertingToType(type)
+        let isCollection = newValue.isCollection
+
+        // We only need child regeneration if we changed from being a scalar to a collection or
+        // vice versa.  If we changed types from one collection to another, we keep our children
+        // as part of type conversion, so the node hierarchy doesn’t change at all.
+        self.setValue(newValue, ofTreeNode: treeNode, needsChildRegeneration: wasCollection != isCollection)
+    }
+
+
+    /// Returns the object value to display in the Value column for the specified tree node.
+    /// - parameter treeNode: The tree node whose object value is being returned.
     private func valueOfTreeNode(treeNode: PropertyListTreeNode) -> AnyObject {
         switch treeNode.item {
         case .ArrayItem:

    }


    private func setItem(newItem: PropertyListItem, ofTreeNodeAtIndexPath indexPath: NSIndexPath, nodeOperation: TreeNodeOperation? = nil) {
        let treeNode = self.tree.nodeAtIndexPath(indexPath)
        let oldItem = treeNode.item

        case let .DictionaryItem(dictionary):
            return dictionary.elementAtIndex(index).key
        default:
            assert(false, "Impossible state: all nodes must be the root node or the child of a dictionary/array")
        }
    }


    /// Sets the key for the specified tree node. Due to the implementation of other data source
    /// methods, the tree node can be assumed to have a dictionary item as its parent. 
    ///
    /// This method works by getting the parent of the specified tree node, getting its
    /// (dictionary) item, and editing it by replacing the tree node’s corresponding key with
    /// the new key. The parent node’s (dictionary) item is then replaced with the edited
    /// version using `‑setItem:ofTreeNodeAtIndexPath:nodeOperation:`. That method handles
    /// making actual model changes and registering an appropriate undo action.
    ///
    /// - parameter key: The key being set. If the dictionary already contains this key, has no
    ///       effect. This should not be possible because of our implementation of 
    //        `control:textShouldEndEditing:`.
    /// - parameter treeNode: The tree node whose key is being set.
    private func setKey(key: String, ofTreeNode treeNode: PropertyListTreeNode) {
        guard let parentNode = treeNode.parentNode, index = treeNode.index else {
            return
