     }
     
     func runCountdown() {
+        isStarted = true
         myTimer = Timer.scheduledTimer(timeInterval: 0.125, target: self, selector:#selector(ViewController.randomMid), userInfo: nil, repeats: true)
     }
     

    {
        print("Start")
        midResult = getMidFromFiles()
        runCountdown()
    }
    
    @IBAction func onEndClick(_ sender: NSButton)
    {
        print("Stop")
        myTimer.invalidate()
        midTextField.stringValue = midResult
        
    }


class ViewController: NSViewController {

    var isStarted = false
    var pathString: String?
    let fm = FileManager.default
    var myTimer = Timer()
