     }
     
     @IBAction func addAppClicked(_ sender: Any) {
-        AppNamesPicker().pickAppNames{ self.selectedApps = $0 }
+        AppNamesPicker().pickAppNames{ self.selectedApps.apps += $0 }
     }
     
     @IBAction func removeAppClicked(_ sender: Any) {
         
-        selectedApps = selectedApps.filter {
-            !self.selectedAppsSourceList.isRowSelected(self.selectedApps.index(of: $0) ?? -1)
+        selectedApps.apps = selectedApps.apps.filter {
+            !self.selectedAppsSourceList.isRowSelected(self.selectedApps.apps.index(of: $0) ?? -1)
         }
         selectedAppsSourceList.deselectAll(self)
     }

        
        ProcessInfo.processInfo.disableAutomaticTermination("A timer is running")
        
        hushTimeBlock = HushTimeBlock(appNames: selectedApps,
                                      time: timeSelector.value,
                                      fireOnUpdate: { [weak self] in
                                        self?.remainingTime = $0

    case notRunning
}

struct SelectedApps {
    
    var apps: [String] {
        get {
            return NSOrderedSet(array: unorderedApps).array as? [String] ?? unorderedApps
        }
        set {
            unorderedApps = newValue.sorted()
        }
    }
    
    private var unorderedApps = [String]()
}

class ViewController: NSViewController {

    @IBOutlet private weak var timeSelector: TimeSelector!
    @IBOutlet private weak var remainingTimeLabel: NSTextField!
    @IBOutlet private weak var selectedAppsSourceList: NSOutlineView!
    
    fileprivate var selectedApps = SelectedApps() {
        didSet {
            selectedAppsSourceList.reloadData()
        }
