     }
   }
   
+  // MARK: - Utility methods
+  private func checkForPreExistingTimer() {
+    if UIApplication.sharedApplication().scheduledLocalNotifications.count > 0 {
+      timerRunning = true
+    }
+  }
+
+  private func createTimer() -> UILocalNotification {
+    let notification = UILocalNotification()
+    notification.category = timerFiredCategoryString
+    notification.fireDate = NSDate(timeIntervalSinceNow: NSTimeInterval(timerDuration))
+    notification.alertBody = "Your time is up!"
+    return notification
+  }
   
   private func registerForNotifications() {
     let requestedTypes = UIUserNotificationType.Alert | .Sound

}

class TimerNotificationManager: Printable {
  var timerRunning = false
  var delegate: TimerNotificationManagerDelegate?
  var timerDuration: Float {
    didSet {
      delegate?.timerStatusChanged()

  }

  init() {
    timerRunning = false
    timerDuration = 30.0
    registerForNotifications()
    checkForPreExistingTimer()
  }
  
  func startTimer() {
    if !timerRunning {
      // Create the notification...
      let timer = createTimer()
      UIApplication.sharedApplication().scheduleLocalNotification(timer)
      timerRunning = true
    }
  }
  
  func stopTimer() {
    if timerRunning {
      // Kill all local notifications
      UIApplication.sharedApplication().cancelAllLocalNotifications()
      timerRunning = false
    }
  }
  
