     var lastRefreshDate: NSDate?
     
     var healthKitAvailable = true
+    
+    let managedContext = (UIApplication.sharedApplication().delegate as! AppDelegate).managedObjectContext!
+    
+    var initialAppearance = true
 
     override func viewDidLoad() {
         super.viewDidLoad()

            if let cell = tableView.dequeueReusableCellWithIdentifier("Cell") as? WorkoutTableViewCell {
                let workout  = self.workouts[indexPath.row]
                let startDate = workout.startDate.relativeDateFormat()
                
                cell.startTimeLabel?.text = startDate
                cell.durationLabel?.text = stringFromTimeInterval(workout.duration)


import UIKit
import HealthKit
import CoreData

class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {
    
