     // Save object in a background thread
     fileprivate func addCurrentLocation(_ rowLocation: CLLocation) {
         let location = makeLocation(rawLocation: rowLocation)
-        DispatchQueue.main.async {
+        DispatchQueue.global().async {
             // Get the default Realm
             let realm = try! Realm()
             realm.beginWrite()
+
             // Create a Location object
             realm.add(location)
             try! realm.commitWrite()

            annotation.coordinate = CLLocationCoordinate2DMake(location.latitude, location.longitude)
            annotation.title = "\(location.latitude),\(location.longitude)"
            annotation.subtitle = location.createdAt.description

            DispatchQueue.main.async(execute: {
                self.mapView.addAnnotation(annotation)
            })
        }
    }



    // Delete old (-1 day) objects in a background thread
    fileprivate func deleteOldLocations() {
        DispatchQueue.global().async {
            // Get the default Realm
            let realm = try! Realm()

