         
     }
     
+    private func initializeProgrammingSession() {
+        
+        let appSettings = AppSettings()
+        let sessionDuration = appSettings.ConfiguredSessionDuration
+        let lastState = appSettings.LastState
+        
+        sessionControl =
+            ProgrammingSession(
+                withDeveloper: lastState.currentDeveloper,
+                delegate: SessionDelegateNotificationDecorator(other: self, notifications: LocalNotifications(timeInterval: sessionDuration.TotalSeconds)),
+                timer: SystemTimer(durationInSeconds: sessionDuration.TotalSeconds, repeatWhenExpired: false),
+                dateTime: SystemDateTime(),
+                sessionDurationInMinutes: sessionDuration.TotalMinutes)
+        
+        sessionControl =
+            sessionControl?.restoreState(sessionState: lastState.sessionState, sessionEndsOn: lastState.sessionEndsOn)
+    }
+    
     private func updateDeveloperImages(activeDeveloper: Developer) {
         rightDeveloperImageView.image = developerStateImage(isActive: activeDeveloper == .right)
         leftDeveloperImageView.image = developerStateImage(isActive: activeDeveloper == .left)

    private let inactiveOffset: CGFloat = 25
    private var disableNotificationWarningShown = false
    
    fileprivate let appSettings = AppSettings()
    fileprivate var sessionControl: Session?
    fileprivate let updateTimer = SystemTimer(durationInSeconds: 0.25, repeatWhenExpired: true)
    

    override func viewDidLoad() {
        super.viewDidLoad()
        
        initializeNotifications()
        initializeProgrammingSession()
        
        updateUserInterface(developer: sessionControl!.developer)
    }

    @IBAction func actionFlipDeveloper(_ sender: Any) {
