         }
     }
     
-<<<<<<< HEAD
-    var wakeTimePickerHidden = true
-    var sleepTimePickerHidden = true
-=======
+    var birthdayPickerHidden = false
     var wakeTimePickerHidden = false
     var sleepTimePickerHidden = false
->>>>>>> origin/master
-
+
+    //MARK: viewDidLoad setup
+    
     override func viewDidLoad() {
         super.viewDidLoad()
         
         // Load userdefaults
         let defaults = UserDefaults.standard
+        stateSwitch.setOn(defaults.bool(forKey: "bottleState"), animated: false)
+        serialTextField.text = defaults.string(forKey: "serial")
         waterSwitch.setOn(defaults.bool(forKey: "customGoalSwitch"), animated: false)
         customWaterTextField.text = defaults.string(forKey: "customGoal")
         sexLabel.text = defaults.string(forKey: "selectedSex")

            
            defaults.set(timeLabel.text, forKey: "reminderTime")
            
<<<<<<< HEAD
            defaults.set(DateFormatter.localizedString(from: wakeTimePicker.date, dateStyle: DateFormatter.Style.none, timeStyle: DateFormatter.Style.short), forKey: "wakeTime")
            defaults.set(DateFormatter.localizedString(from: sleepTimePicker.date, dateStyle: DateFormatter.Style.none, timeStyle: DateFormatter.Style.short), forKey: "sleepTime")
=======
            let dateFormatter = DateFormatter()
            dateFormatter.calendar = Calendar(identifier: .iso8601)
            dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss +zzzz"
            dateFormatter.locale = Locale(identifier: "en_US_POSIX")
            
            let wakeString = dateFormatter.string(from: wakeTimePicker.date)
            let sleepString = dateFormatter.string(from: sleepTimePicker.date)
            
            defaults.set(wakeString, forKey: "wakeTime")
            defaults.set(sleepString, forKey: "sleepTime")
>>>>>>> origin/master
        }
    }
}

        
        addDoneButton() // Adds done button to num pad
        
        // Time picker setup
        
        birthdayPickerHidden = true
        wakeTimePickerHidden = true
        sleepTimePickerHidden = true
        
        let birthday = String(describing: defaults.object(forKey: "birthday")!)
        let wakeTime = String(describing: defaults.object(forKey: "wakeTime")!)
        let sleepTime = String(describing: defaults.object(forKey: "sleepTime")!)
        
        birthdayPicker.setDate(dateFormatter.date(from: birthday)!, animated: false)
        wakeTimePicker.setDate(dateFormatter.date(from: wakeTime)!, animated: false)
        sleepTimePicker.setDate(dateFormatter.date(from: sleepTime)!, animated: false)
        
        timePickerChanged(label: birthdayLabel, timePicker: birthdayPicker, isTime: false)
        timePickerChanged(label: wakeTimeLabel, timePicker: wakeTimePicker, isTime: true)
        timePickerChanged(label: sleepTimeLabel, timePicker: sleepTimePicker, isTime: true)
        
        toggleTimePickerColor(titleLabel: birthLabel, timePickerHidden: birthdayPickerHidden)
        toggleTimePickerColor(titleLabel: wakeLabel, timePickerHidden: wakeTimePickerHidden)
        toggleTimePickerColor(titleLabel: sleepLabel, timePickerHidden: sleepTimePickerHidden)
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
    }
    
    //MARK: Datepicker setup
    
    override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
        // Animates selection
        tableView.deselectRow(at: indexPath, animated: true)
        
        // Toggles birthday picker when when cell for time is clicked
        if indexPath.section == 1 && indexPath.row == 1 {
            
            // Shows and hides time picker: toggleTimePicker()
            birthdayPickerHidden = !birthdayPickerHidden
            tableView.beginUpdates()
            tableView.endUpdates()
            
            toggleTimePickerColor(titleLabel: birthLabel, timePickerHidden: birthdayPickerHidden)
        }
        
        // Toggles wake date picker when when cell for time is clicked
        if indexPath.section == 3 && indexPath.row == 2 {
            
            // Shows and hides time picker: toggleTimePicker()
            wakeTimePickerHidden = !wakeTimePickerHidden
            tableView.beginUpdates()
            tableView.endUpdates()
            
            toggleTimePickerColor(titleLabel: wakeLabel, timePickerHidden: wakeTimePickerHidden)
        }
        // Toggles wake date picker when when cell for time is clicked
        if indexPath.section == 3 && indexPath.row == 4 {
            
            // Shows and hides time picker: toggleTimePicker()
            sleepTimePickerHidden = !sleepTimePickerHidden
            tableView.beginUpdates()
            tableView.endUpdates()
            
            toggleTimePickerColor(titleLabel: sleepLabel, timePickerHidden: sleepTimePickerHidden)
        }
    }
    
    //MARK: Hidden cell setup
    
    override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
        if indexPath.section == 2 && indexPath.row == 1 {
            if waterSwitch.isOn {
                customWaterIntakeCell.isHidden = false
                return 55.0
