 
     var displayImage: NSImage? {
         get {
-            let size = NSMakeSize(CGFloat(kTitleNormal), CGFloat(kTitleNormal))
-
-            let tmp = QLThumbnailImageCreate(kCFAllocatorDefault, self.fileURL! as CFURL , size, nil)
-            if let tmpImage = tmp?.takeUnretainedValue() {
-                let tmpIcon = NSImage(cgImage: tmpImage, size: size)
-                return tmpIcon
-            }
-            else
-            {
-                return NSApp.applicationIconImage
-            }
+            if (self.fileURL?.isFileURL) != nil {
+                let size = NSMakeSize(CGFloat(kTitleNormal), CGFloat(kTitleNormal))
+                
+                let tmp = QLThumbnailImageCreate(kCFAllocatorDefault, self.fileURL! as CFURL , size, nil)
+                if let tmpImage = tmp?.takeUnretainedValue() {
+                    let tmpIcon = NSImage(cgImage: tmpImage, size: size)
+                    return tmpIcon
+                }
+            }
+            return NSApp.applicationIconImage
         }
     }
     override var displayName: String! {
         get {
-            if let justTheName = super.displayName  {
-                return (justTheName as NSString).deletingPathExtension
-            }
-            else
-            {
-                return super.displayName
-            }
+            if (self.fileURL?.isFileURL) != nil {
+                if let justTheName = super.displayName  {
+                    return (justTheName as NSString).deletingPathExtension
+                }
+            }
+            return super.displayName
         }
         set (newName) {
             super.displayName = newName

            throw NSError(domain: NSOSStatusErrorDomain, code: unimpErr, userInfo: nil)
        }
    }
    override func write(to url: URL, ofType typeName: String) throws {
        switch typeName {
        case "h2w":

    
    // See values in HeliumPanelController.TranslucencyPreference
    let translucencyPreference = Setup<HeliumPanelController.TranslucencyPreference>("rawTranslucencyPreference", value: .never)
}

class HeliumDocumentController : NSDocumentController {
    override func makeDocument(for urlOrNil: URL?, withContentsOf contentsURL: URL, ofType typeName: String) throws -> NSDocument {
        var doc: Document
        do {
            doc = try Document.init(contentsOf: contentsURL, ofType: contentsURL.pathExtension)
            if (urlOrNil != nil) {
                doc.fileURL = urlOrNil
                doc.fileType = urlOrNil?.pathExtension
            }
        } catch let error {
            NSApp.presentError(error)
            doc = try Document.init(contentsOf: contentsURL, ofType: contentsURL.pathExtension)
        }
        return doc
    }
}

class Document : NSDocument {
