             case (.NeedsConfiguration, .None):
                 break
             }
-            
+
             NSUserDefaults.standardUserDefaults().transmitterID = transmitterID
         }
     }
-    
+
     // MARK: Loop model inputs
-    
+
     var basalRateSchedule: BasalRateSchedule? = NSUserDefaults.standardUserDefaults().basalRateSchedule {
         didSet {
             doseStore.basalProfile = basalRateSchedule
-            
+
             NSUserDefaults.standardUserDefaults().basalRateSchedule = basalRateSchedule
-            
+
             AnalyticsManager.didChangeBasalRateSchedule()
         }
     }
-    
+
     var carbRatioSchedule: CarbRatioSchedule? = NSUserDefaults.standardUserDefaults().carbRatioSchedule {
         didSet {
             carbStore?.carbRatioSchedule = carbRatioSchedule
-            
+
             NSUserDefaults.standardUserDefaults().carbRatioSchedule = carbRatioSchedule
-            
+
             AnalyticsManager.didChangeCarbRatioSchedule()
         }
     }
-    
+
     var insulinActionDuration: NSTimeInterval? = NSUserDefaults.standardUserDefaults().insulinActionDuration {
         didSet {
             doseStore.insulinActionDuration = insulinActionDuration
-            
+
             NSUserDefaults.standardUserDefaults().insulinActionDuration = insulinActionDuration
-            
+
             if oldValue != insulinActionDuration {
                 AnalyticsManager.didChangeInsulinActionDuration()
             }
         }
     }
-    
+
     var insulinSensitivitySchedule: InsulinSensitivitySchedule? = NSUserDefaults.standardUserDefaults().insulinSensitivitySchedule {
         didSet {
             carbStore?.insulinSensitivitySchedule = insulinSensitivitySchedule
             doseStore.insulinSensitivitySchedule = insulinSensitivitySchedule
-            
+
             NSUserDefaults.standardUserDefaults().insulinSensitivitySchedule = insulinSensitivitySchedule
-            
+
             AnalyticsManager.didChangeInsulinSensitivitySchedule()
         }
     }
-    
+
     var glucoseTargetRangeSchedule: GlucoseRangeSchedule? = NSUserDefaults.standardUserDefaults().glucoseTargetRangeSchedule {
         didSet {
             NSUserDefaults.standardUserDefaults().glucoseTargetRangeSchedule = glucoseTargetRangeSchedule
-            
+
             AnalyticsManager.didChangeGlucoseTargetRangeSchedule()
         }
     }
-    
+
     var maximumBasalRatePerHour: Double? = NSUserDefaults.standardUserDefaults().maximumBasalRatePerHour {
         didSet {
             NSUserDefaults.standardUserDefaults().maximumBasalRatePerHour = maximumBasalRatePerHour
-            
+
             AnalyticsManager.didChangeMaximumBasalRate()
         }
     }
-    
+
     var maximumBolus: Double? = NSUserDefaults.standardUserDefaults().maximumBolus {
         didSet {
             NSUserDefaults.standardUserDefaults().maximumBolus = maximumBolus
-            
+
             AnalyticsManager.didChangeMaximumBolus()
         }
     }
-    
+
     // MARK: - CarbKit
-    
+
     let carbStore: CarbStore?
-    
+
     // MARK: CarbStoreDelegate
-    
+
     func carbStore(_: CarbStore, didError error: CarbStore.Error) {
         logger?.addError(error, fromSource: "CarbStore")
     }
-    
+
     // MARK: - GlucoseKit
-    
+
     let glucoseStore: GlucoseStore? = GlucoseStore()
-    
+
     // MARK: - InsulinKit
-    
+
     let doseStore: DoseStore
-    
+
     // MARK: - WatchKit
-    
+
     private(set) var watchManager: WatchDataManager!
-    
+
     @objc private func loopDataDidUpdateNotification(_: NSNotification) {
         watchManager.updateWatch()
     }
-    
+
     // MARK: - Initialization
-    
+
     static let sharedManager = DeviceDataManager()
-    
+
     private(set) var loopManager: LoopDataManager!
-    
+
     init() {
         let pumpID = NSUserDefaults.standardUserDefaults().pumpID
-        
+
         doseStore = DoseStore(
             pumpID: pumpID,
             insulinActionDuration: insulinActionDuration,

                if let error = error {
                    self.logger?.addError(error, fromSource: "ShareClient")
                }
                
                guard let glucose = glucose?.first else {
                    return
                }
                
                // Ignore glucose values that are less than a minute newer than our previous value
                if let latestGlucose = glucoseStore.latestGlucose where latestGlucose.startDate.timeIntervalSinceDate(glucose.startDate) > -NSTimeInterval(minutes: 1)  {
                    return
                }
                
                glucoseStore.addGlucose(glucose.quantity, date: glucose.startDate, displayOnly: false, device: nil) { (_, value, error) -> Void in
                    if let error = error {
                        self.logger?.addError(error, fromSource: "GlucoseStore")
                    }
                    
                    self.latestGlucoseValue = value
                    
                    NSNotificationCenter.defaultCenter().postNotificationName(self.dynamicType.GlucoseUpdatedNotification, object: self)
                }
            }
        }
    }
    
    // MARK: - Configuration
    
    // MARK: Pump
    
    private var connectedPeripheralIDs: Set<String> = Set(NSUserDefaults.standardUserDefaults().connectedPeripheralIDs) {
        didSet {
            NSUserDefaults.standardUserDefaults().connectedPeripheralIDs = Array(connectedPeripheralIDs)
        }
    }
    
    var pumpID: String? {
        get {
            return pumpState?.pumpID

            }
        }
    }

    var transmitterID: String? {
        didSet {
            if transmitterID?.characters.count != 6 {
                transmitterID = nil
            }

            switch (transmitterState, transmitterID) {
            case (.NeedsConfiguration, let transmitterID?):
                transmitterState = .Ready(Transmitter(
