 import Cocoa
 
 class Document: NSDocument {
-
-    // TODO Reorganize, make things private, etc.
-
-    private let midiMonitorFileType = "com.snoize.midimonitor"
-    private let midiMonitorErrorDomain = "com.snoize.midimonitor"
-
-    private(set) var windowSettings: [String: Any]?
-
-    // MIDI processing
-    private let stream = CombinationInputStream()
-    private let messageFilter = SMMessageFilter()
-    private let history = SMMessageHistory()
-
-    // Transient data
-    private var isSysExUpdateQueued = false
-
-    override class var autosavesInPlace: Bool {
-        return true
-    }
 
     override init() {
         super.init()

        }
    }

    var savedMessages: [SMMessage] {
        return history.savedMessages
    }

    var monitorWindowController: MonitorWindowController? {

        NotificationCenter.default.removeObserver(self)
    }

    // MARK: Internal

    private let midiMonitorFileType = "com.snoize.midimonitor"
    private let midiMonitorErrorDomain = "com.snoize.midimonitor"

    private(set) var windowSettings: [String: Any]?

    // MIDI processing
    private let stream = CombinationInputStream()
    private let messageFilter = SMMessageFilter()
    private let history = SMMessageHistory()

    // Transient data
    private var isSysExUpdateQueued = false

}

extension Document {

    // MARK: Document data (read and write)

    override class var autosavesInPlace: Bool {
        return true
    }

    override func data(ofType typeName: String) throws -> Data {
