             AppConfig.sharedConfiguration.applicationUserDefaults.synchronize()
         }
 
-        Datamanager.sharedManager().cleanupPlots()
+        Datamanager.sharedManager().cleanupPlots { () -> Void in
+            WindManager.sharedManager.refreshInterval = 60
+            WindManager.sharedManager.startUpdating()
+        }
 
         application.setMinimumBackgroundFetchInterval(UIApplicationBackgroundFetchIntervalMinimum)
 
-        WindManager.sharedManager.refreshInterval = 60
-        WindManager.sharedManager.startUpdating()
-
         return true
     }
+
 
     func application(application: UIApplication, willFinishLaunchingWithOptions launchOptions: [NSObject : AnyObject]?) -> Bool {
 

    var window: UIWindow?
    let _formatterQueue = dispatch_queue_create("formatter queue", nil);

    func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
        AFNetworkActivityIndicatorManager.sharedManager().enabled = true


        RHEVindsidenAPIClient.defaultManager().background = true
    }


    func applicationDidEnterBackground(application: UIApplication) {
    }


    func applicationWillEnterForeground(application: UIApplication) {
    }


    func applicationDidBecomeActive(application: UIApplication) {
        RHEVindsidenAPIClient.defaultManager().background = false
    }


    func applicationWillTerminate(application: UIApplication) {
        Datamanager.sharedManager().saveContext()
