             return managedObjectContext!
         }
         
-        let coordinator: NSPersistentStoreCoordinator? = self.persistentStoreCoordinator
-        if coordinator != nil {
+        if let coordinator: NSPersistentStoreCoordinator = self.persistentStoreCoordinator {
             managedObjectContext = NSManagedObjectContext(concurrencyType: .MainQueueConcurrencyType)
-            managedObjectContext?.persistentStoreCoordinator = coordinator!
+            managedObjectContext?.persistentStoreCoordinator = coordinator
             managedObjectContext?.undoManager = nil
             managedObjectContext?.mergePolicy = NSErrorMergePolicy
             

        if managedObjectContext.hasChanges {
            do {
                try managedObjectContext.save()
            } catch {
                fatalError("Error migrating store: \(error)")
            }
        }
    }
    

        
        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0)) {
            let urls = NSFileManager.defaultManager().URLsForDirectory(.DocumentDirectory, inDomains: .UserDomainMask)
            if let docURL = urls.last {
                let storeURL = docURL.URLByAppendingPathComponent("Brave.sqlite")
                do {
                    try self.persistentStoreCoordinator.addPersistentStoreWithType(NSSQLiteStoreType, configuration: nil, URL: storeURL, options: nil)
                }
                catch {
                    fatalError("Error migrating store: \(error)")
                }
            }
        }
    }
    
    // Writes could still be executed on main thread, but recommended to use DataController.write {...}
    static func saveContext() {
        guard let managedObjectContext: NSManagedObjectContext = DataController.singleton.managedObjectContext else {
            return
