         } else {
             resultLabel.text = calculator.minus + currentText
         }
+        
+        calculator.currentValue = Double(resultLabel!.text!)
     }
     
     @IBAction func onOperationTapped(_ sender: CalculatorButton) {
-        calculator.previousValue = Double(resultLabel!.text!)
+        calculator.previousValue = calculator.currentValue
+        calculator.currentValue = nil
         calculator.currentOperator = sender.titleLabel!.text!
         highlightOperationButton()
     }
     
     @IBAction func onClearTapped(_ sender: CalculatorButton) {
         resultLabel.text = zero
+        calculator.currentValue = nil
     }
     
     @IBAction func onAllClearTapped(_ sender: CalculatorButton) {

        } else {
            resultLabel.text?.append(period)
        }
    }
    
    @IBAction func onBackspaceTapped(_ sender: CalculatorButton) {

        } else {
            resultLabel.text = currentText.substring(to: currentText.characters.index(before: currentText.endIndex))
        }
        
        calculator.currentValue = Double(resultLabel!.text!)
    }
    
    @IBAction func onNegativeTapped(_ sender: CalculatorButton) {
