         stream.virtualEndpointName = virtualEndpointName
     }
 
-    private func autoselectSources() {
-        let groups = inputSourceGroups
-        var sourcesSet: Set<AnyHashable> = []  // TODO Should become Set<SMInputStreamSource>
-
-        let defaults = UserDefaults.standard
-
-        if defaults.bool(forKey: PreferenceKeys.selectOrdinarySourcesInNewDocument) {
-            if groups.count > 0,
-               let sources = groups[0].sources as? [AnyHashable] {
-                sourcesSet.formUnion(sources)
-            }
-        }
-
-        if defaults.bool(forKey: PreferenceKeys.selectVirtualDestinationInNewDocument) {
-            if groups.count > 1,
-               let sources = groups[1].sources as? [AnyHashable] {
-                sourcesSet.formUnion(sources)
-            }
-        }
-
-        if defaults.bool(forKey: PreferenceKeys.selectSpyingDestinationsInNewDocument) {
-            if groups.count > 2,
-               let sources = groups[2].sources as? [AnyHashable] {
-                sourcesSet.formUnion(sources)
-            }
-        }
-
-        selectedInputSources = sourcesSet
+}
+
+extension Document {
+
+    // MARK: Updates when changes happen
+
+    @objc private func sourceListDidChange(_ notification: Notification?) {
+        monitorWindowController?.updateSources()
+
+        // Also, it's possible that the endpoint names went from being unique to non-unique, so we need
+        // to refresh the messages displayed.
+        updateMessages(scrollingToBottom: false)
     }
 
     @objc private func historyDidChange(_ notification: Notification?) {

        NotificationCenter.default.removeObserver(self)
    }

    override func makeWindowControllers() {
        addWindowController(MonitorWindowController())
    }

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

        return streamSettings
    }

    private var badFileTypeError: Error {
        let reason = NSLocalizedString("Unknown file type.", tableName: "MIDIMonitor", bundle: SMBundleForObject(self), comment: "error reason for unknown file type read or write")
        return NSError(domain: midiMonitorErrorDomain, code: 1, userInfo: [NSLocalizedFailureReasonErrorKey: reason])
    }

    private var badFileContentsError: Error {
        let reason = NSLocalizedString("Can't read the contents of the file.", tableName: "MIDIMonitor", bundle: SMBundleForObject(self), comment: "error reason for unknown file contents")
        return NSError(domain: midiMonitorErrorDomain, code: 2, userInfo: [NSLocalizedFailureReasonErrorKey: reason])
    }

    override func updateChangeCount(_ change: NSDocument.ChangeType) {
        // Clear the undo stack whenever we load or save.
        super.updateChangeCount(change)
