     }
     
     override func write(to url: URL, ofType typeName: String) throws {
-        switch typeName {
-        case "h3w":
-            let dict = NSDictionary.init()
-            for (name,playitem) in playlists {
-                let item = (playitem as! PlayItem).dictionary()
-                dict.setValue(item, forKey: name)
-            }
-            dict.write(to: url, atomically: true)
-            break
-            
-        default:
-            //  "DocumentType" writter to user defaults play items dictionary
-            var lists = UserDefaults.standard.dictionary(forKey: UserSettings.Playitems.default) ?? NSDictionary.init() as! [String : Any]
-            for (name,list) in playlists {
-                var items = [Dictionary<String,Any>]()
-                for item in list as! [PlayItem] {
-                    items.append(item.dictionary())
-                }
-                lists[name] = items
-            }
-            
-            //  Cache ourselves too
-            let item = self.dictionary()
-            lists[self.displayName] = item
-            
-            UserDefaults.standard.set(lists, forKey: UserSettings.Playlists.default)
+        //  When a document is written, update in global items
+        if var lists = UserDefaults.standard.dictionary(forKey: UserSettings.Playitems.default) {
+            lists[self.displayName] = self.dictionary()
+            UserDefaults.standard.set(lists, forKey: UserSettings.Playitems.default)
             UserDefaults.standard.synchronize()
-        }
-        self.updateChangeCount(.changeCleared)
+            self.updateChangeCount(.changeCleared)
+        }
     }
     override func writeSafely(to url: URL, ofType typeName: String, for saveOperation: NSSaveOperationType) throws {
         do {


class Document : NSDocument {

    var playlists: Dictionary<String, Any>
    var settings: Settings
    
    func dictionary() -> Dictionary<String,Any> {

        self.settings.opacityPercentage.value = (plist[k.alpha] as AnyObject).intValue ?? 60
        self.settings.translucencyPreference.value = HeliumPanelController.TranslucencyPreference(rawValue: (plist[k.trans] as AnyObject).intValue ?? 0)!
    }
    
    func update(to url: URL, ofType typeName: String) {
        if let dict = NSDictionary(contentsOf: url) {
            if let item = dict.value(forKey: "settings") {
                self.restoreSettings(with: item as! Dictionary<String,Any> )
            }
        }
        fileType = typeName
        fileURL = url
        self.save(self)
    }
    
    override init() {
        settings = Settings()
        super.init()
    }
    
