     // Preferences
     Observable
       .of(
-        actionSource
-          .mapOmittingNil { $0 as? PrefWindow.Action }
-          .map { self.appStateActionPair(for: $0) }
-          .reduce(by: PrefWindowReducer())
-          .filter { $0.modified }
-          .map { $0.state },
-        actionSource
-          .mapOmittingNil { $0 as? GeneralPref.Action }
-          .map { self.appStateActionPair(for: $0) }
-          .reduce(by: GeneralPrefReducer())
-          .filter { $0.modified }
-          .map { $0.state },
-        actionSource
-          .mapOmittingNil { $0 as? AppearancePref.Action }
-          .map { self.appStateActionPair(for: $0) }
-          .reduce(by: AppearancePrefReducer())
-          .filter { $0.modified }
-          .map { $0.state },
-        actionSource
-          .mapOmittingNil { $0 as? AdvancedPref.Action }
-          .map { self.appStateActionPair(for: $0) }
-          .reduce(by: AdvancedPrefReducer())
-          .filter { $0.modified }
-          .map { $0.state }
-      )
+        self.actionSourceForAppState()
+            .reduce(by: PrefWindowReducer())
+            .filterMapPair(),
+        self.actionSourceForAppState()
+            .reduce(by: GeneralPrefReducer())
+            .filterMapPair(),
+        self.actionSourceForAppState()
+            .reduce(by: AppearancePrefReducer())
+            .filterMapPair(),
+        self.actionSourceForAppState()
+            .reduce(by: AdvancedPrefReducer())
+            .filterMapPair()
+        )
       .merge()
       .apply(to: prefService.forPrefPanes)
       .subscribe(onNext: self.emitAppState)

    self.appState = state

    self.stateSource = self.stateSubject.asObservable()
    let actionSource = self.actionEmitter.observable

    self.httpService = HttpServerService(port: baseServerUrl.port!)


    // MainWindow.State
    Observable
      .of(
        self.actionSourceForMainWindow()
            .reduce(by: MainWindowReducer())
            .reduce(by: markdownReducer.forMainWindow)
            .filter { $0.modified }
            .apply(to: previewService.forMainWindow)
            .apply(to: self.httpService.forMainWindow)
            .map { $0.state },
        self.actionSourceForMainWindow()
            .reduce(by: PreviewToolReducer(baseServerUrl: baseServerUrl))
            .filterMapPair(),
        self.actionSourceForMainWindow()
            .reduce(by: htmlPreviewToolReducer)
            .filter { $0.modified }
            .apply(to: self.httpService.forHtmlPreviewTool)
            .map { $0.state },
        self.actionSourceForMainWindow()
            .reduce(by: FileBrowserReducer())
            .filterMapPair(),
        self.actionSourceForMainWindow()
            .reduce(by: OpenedFileListReducer())
            .reduce(by: markdownReducer.forOpenedFileList)
            .filter { $0.modified }
            .apply(to: previewService.forOpenedFileList)
            .map { $0.state }
      )
      .merge()
      .subscribe(onNext: self.emitAppState)
