     }
     
     @IBAction func pageTouchBarDidChange(_ sender: NSSegmentedControl) {
-        DatasourceController.shared.save()
-        DatasourceController.shared.currentViewIndex = sender.selectedSegment + 1
-        DatasourceController.shared.load()
-        
-        setupViewButtons()
+        changeView(viewIndex: sender.selectedSegment + 1)
     }
     
     func createDrawScene() {

            createDrawScene()
        }
        
        clearButton.isEnabled = DatasourceController.shared.currentMode == .text || DatasourceController.shared.currentMode == .sketch
    }
    
    var rawText: String = ""

            .receive(on: DispatchQueue.main)
            .sink { [weak self] newMode in
                self?.contentModeButton.setSelected(true, forSegment: newMode.rawValue)
                self?.syncUI(newMode: newMode)
            }
            .store(in: &self.subscribers)
    }
