 
     func previousPlace(forPlace place: Place) -> Place? {
         return self.placesLock.withReadLock {
-            guard let currentPlaceIndex = self.placeKeyMap[place.id],
+            guard let currentPlaceIndex = self.placeKeyToDisplayedPlacesIndexMap[place.id],
                 currentPlaceIndex > displayedPlaces.startIndex else { return nil }
 
             return displayedPlaces[displayedPlaces.index(before: currentPlaceIndex)]

            for (index, place) in displayedPlaces.enumerated() {
                placesMap[place.id] = index
            }
            placeKeyMap = placesMap
        }
    }

    /// A mapping from place key to index in `displayedPlaces` - this must update when
    /// `displayedPlaces` does.
    fileprivate var placeKeyMap = [String: Int]()

    /// Protects allPlaces, displayedPlaces, and placeKeyMap.
    fileprivate let placesLock = NSLock()

        for (index, place) in displayedPlaces.enumerated() {
            placesMap[place.id] = index
        }
        self.placeKeyToDisplayedPlacesIndexMap = placesMap
    }

    func place(forKey key: String, callback: @escaping (Place?) -> ()) {
