     )
 }
 
-func setLocation(for photo: PhotosMediaItem, from flickrPhoto: [String: Any]) {
-    if let locationJSON = flickrPhoto["location"] as? [String: Any],
-        let latitudeString = locationJSON["latitude"] as? String,
-        let flickrLatitude = Double(latitudeString),
-        let longitudeString = locationJSON["longitude"] as? String,
-        let flickrLongitude = Double(longitudeString) {
-        let flickrLocation = [
-            flickrLatitude,
-            flickrLongitude
+func setLocation(for photo: PhotosMediaItem, from flickrPhoto: FlickrPhoto?) {
+    if let flickrLocation = flickrPhoto?.location {
+        var newLocation = [
+            flickrLocation.latitude,
+            flickrLocation.longitude
         ]
-        let newLocation = flickrLocation
         if let photoLocation = photo.location, !photoLocation.isEmpty {
-            let distance = getCLLocation(for: flickrLocation).distance(
+            let distance = getCLLocation(for: newLocation).distance(
                 from: getCLLocation(for: photoLocation)
             )
             let distanceFormatter = MKDistanceFormatter()

            "✅  Matched \(photoName) taken on \(photoDate)",
            "(\(candidates.count) candidates)"
        )
        let flickrPhotoSummary = matches[0]

        guard let flickrPhoto = api.call(
            method: "flickr.photos.getInfo",
            parameters: [
                "photo_id": flickrPhotoSummary.id
        ])?["photo"] as? [String: Any] else {
            continue
        }

        setLocation(for: photo, from: flickrPhoto)
    }

    } else {
        if let photoLocation = photo.location, !photoLocation.isEmpty {
            print("-   No location on flickr, but photo has location")
        } else if let tags = flickrPhoto?.tags {
            print("- ⛔️  No location on flickr")
            print(tags)
        }
    }
}
