                     }
                 }
                 
-                if let fileURL = dict.value(forKey: "fileURL") {
-                    self.fileURL = URL(string: (fileURL as! String).addingPercentEncoding(withAllowedCharacters: NSCharacterSet.urlQueryAllowed)!)!
-                    self.fileType = self.fileURL?.pathExtension
+                if let document = dict.value(forKey: "document") {
+                    self.restoreSettings(with: document as! Dictionary<String,Any>)
                     break;
                 }
             }

        switch typeName {
        case "h3w":
            let dict = NSDictionary.init()
            dict.setValue(playlists, forKey: UserSettings.Playlists.default)
            dict.write(to: url, atomically: true)
            break
            
        default:
            //  "DocumentType" writter to user defaults play items dictionary
            var playitems = UserDefaults.standard.dictionary(forKey: UserSettings.Playitems.default)

            for key in playlists.keys {
                for playitem in playlists[key] as! [PlayItem] {
                    let rect = settings.rect.value as NSRect
                    let item : [String:AnyObject] = [k.name  : playitem.name as String as AnyObject,
                                                     k.link  : playitem.link.absoluteString as AnyObject,
                                                     k.time  : playitem.time as AnyObject,
                                                     k.rank  : playitem.rank as AnyObject,
                                                     k.rect  : rect as AnyObject,
                                                     k.label : playitem.label as AnyObject,
                                                     k.hover : playitem.hover as AnyObject,
                                                     k.alpha : playitem.alpha as AnyObject,
                                                     k.trans : playitem.trans as AnyObject]
                    playitems?[playitem.name] = item
                }
            }
            
            //  Cache ourselves too
            let rect = settings.rect.value as NSRect
            let item : [String:AnyObject] = [k.name  : self.displayName as AnyObject,
                                             k.link  : self.fileURL!.absoluteString as AnyObject,
                                             k.time  : settings.time.value as AnyObject,
                                             k.rank  : settings.rank.value as AnyObject,
                                             k.rect  : NSStringFromRect(rect) as AnyObject,
                                             k.label : settings.autoHideTitle.value as AnyObject,
                                             k.hover : settings.disabledFullScreenFloat.value as AnyObject,
                                             k.alpha : settings.opacityPercentage.value as AnyObject,
                                             k.trans : settings.translucencyPreference.value.rawValue as AnyObject]
            playitems?[self.displayName] = item
            
            UserDefaults.standard.set(playitems, forKey: UserSettings.Playitems.default)
            UserDefaults.standard.synchronize()
        }
        self.updateChangeCount(.changeCleared)

            return nil
        }
    }
    
    func dictionary() -> Dictionary<String,[Any]> {
        var plist: Dictionary<String,[Any]> = Dictionary()
        var items: [Any] = Array()
        for item in list {
            items.append(item.dictionary)
        }
        plist[name] = items
        return plist
    }
}

class PlayItem : NSObject, NSCoding {
