     }
     
     @IBAction func onNegativeTapped() {
-        if var currentText = resultLabel.text where currentText != "0" {
-            let firstCharacter = currentText[currentText.startIndex]
-            
-            if firstCharacter == "-" {
+        if var currentText = resultLabel.text where currentText != zero {
+            if currentText.contains(minus) {
                 currentText.remove(at: currentText.startIndex)
                 resultLabel.text = currentText
             } else {
-                resultLabel.text = "-" + currentText
+                resultLabel.text = minus + currentText
             }
         }
     }
     
     @IBAction func onOperationTapped(_ sender: CalculatorButton) {
+        currentOperator = sender.titleLabel!.text!
         previousValue = Double(resultLabel.text!)!
         currentValue = nil
         sender.isHighlighted = true
     }
     
     @IBAction func onClearTapped() {
-        resultLabel.text = "0"
+        resultLabel.text = zero
         currentValue = nil
     }
     

    }
    
    @IBAction func onPeriodTapped() {
        if let currentText = resultLabel.text where !currentText.contains(".") {
            if previousValue != nil && currentValue == nil {
                resultLabel.text = "0."
            } else {
                resultLabel.text?.append(".")
            }
            currentValue = Double(currentText)
        }

import UIKit

class ViewController: UIViewController {
    let zero = "0"
    let period = "."
    let plus = "+"
    let minus = "−"
    let multiply = "×"
    let divide = "÷"
    
    var previousValue: Double?
    var currentValue: Double?
    var currentOperator: String?
    @IBOutlet weak var resultLabel: UILabel!
    
    required init?(coder aDecoder: NSCoder) {
