         self.init(red: CGFloat(red) / 255.0, green: CGFloat(green) / 255.0, blue: CGFloat(blue) / 255.0, alpha: 1.0)
     }
 }
-
-class ViewController: UIViewController {
+/*
+extension String {
+    
+    subscript (i: Int) -> Character {
+        return self[self.startIndex.advancedBy(i)]
+    }
+    
+    subscript (i: Int) -> String {
+        return String(self[i] as Character)
+    }
+    
+    subscript (r: Range<Int>) -> String {
+        let start = startIndex.advancedBy(r.startIndex)
+        let end = start.advancedBy(r.endIndex - r.startIndex)
+        return self[Range(start ..< end)]
+    }
+}
+ */
+/*
+extension String {
+    var validNumber: Bool {
+        guard let _ = self.rangeOfString("^[0-9]+(.?[0-9]+)*$", options: .RegularExpressionSearch) else { return false }
+        return true
+    }
+}
+*/
+class ViewController: UIViewController, UITextFieldDelegate {
 
     // MARK: Outlets
     

            billField.text = String(defaults.double(forKey: "billAmount"))
            onEditingChanged(billField)
        }
    }

    fileprivate func hideBillSplits(){

        totalForTwoLabel.text = "$0.00"
        totalForThreeLabel.text = "$0.00"
        billField.becomeFirstResponder()
        billField.delegate = self
        
    }
    
    override func viewWillAppear(_ animated: Bool) {
