         return true
     }
     
-    //  We cannot alter play time once time is entered; just set to zero to alter the rest
+    //  We cannot alter a playitem once time is entered; just set to zero to alter the rest
     func tableView(_ tableView: NSTableView, shouldEdit tableColumn: NSTableColumn?, row: Int) -> Bool {
         if tableView == playlistTableView {
             return true

    
    //  Start or forget observing any changes
    internal func setObserving(_ state: Bool) {
        for dict in playlists {
            let items: [PlayItem] = dict.value as! [PlayItem]
            self.observe(dict as AnyObject, keyArray: listIvars, observing: state)
            for item in items {
                self.observe(item, keyArray: itemIvars, observing: state)
            }
        }
    }
    
    override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) {
        if let undo = self.undoManager {
            let oldValue = change?[NSKeyValueChangeKey(rawValue: "old")]
            let newValue = change?[NSKeyValueChangeKey(rawValue: "new")]
            
            undo.registerUndo(withTarget: self, handler: { [oldValue] (PlaylistViewController) -> () in

                (object as AnyObject).setValue(oldValue, forKey: keyPath!)
                if !undo.isUndoing {
                    undo.setActionName(String.init(format: "Edit %@", keyPath!))
                }
            })
            Swift.print(String.init(format: "%@ %@ -> %@", keyPath!, oldValue as! CVarArg, newValue as! CVarArg))
        }
    }
    
    //  MARK:- View lifecycle
    override func viewDidLoad() {
        let types = [kUTTypeData as String,
                     kUTTypeURL as String,
                     NSDictionaryControllerKeyValuePair.className(),
                     PlayItem.className(),
                     NSFilenamesPboardType,
                     NSFilesPromisePboardType,

        }
    }

    //  "List" items are controller objects
    internal func addList(_ item: PlayList, atIndex p_index: Int) {
        var index = p_index
        if let undo = self.undoManager {
            undo.registerUndo(withTarget: self, handler: {[oldVals = ["item": item, "index": index] as [String : Any]] (PlaylistViewController) -> () in
                self.removeList(oldVals["item"] as! PlayList, atIndex: oldVals["index"] as! Int)
                if !undo.isUndoing {
                    undo.setActionName("Add PlayList")
                }
            })
        }
        observe(item, keyArray: listIvars, observing: true)
        if index > 0 && index < (playlistArrayController.arrangedObjects as! [PlayItem]).count {
            playlistArrayController.insert(item, atArrangedObjectIndex: index)
        }
        else
        {
            playlistArrayController.addObject(item)
            index = (playlistArrayController.arrangedObjects as! [PlayItem]).count
        }
        DispatchQueue.main.async {
            self.playlistTableView.scrollRowToVisible(index)
        }
    }
    internal func removeList(_ item: PlayList, atIndex index: Int) {
        if let undo = self.undoManager {
            undo.prepare(withInvocationTarget: self.addList(item, atIndex: index))
            if !undo.isUndoing {
