     private var closeBarButtonItem: UIBarButtonItem!
     private var currentGroupingPrecision: QuadKeyPrecision = 1
     private let searchHistoryGroup = "PlaceSearch"
-    private var maxGroupingPrecision: QuadKeyPrecision = 16
-    private var groupingPrecisionDelta: QuadKeyPrecision = 4
-    private var groupingAggressiveness: CLLocationDistance = 0.67
     private var selectedArticlePopover: ArticlePopoverViewController?
     private var selectedArticleKey: String?
     private var placeToSelect: ArticlePlace?

            var articles: [WMFArticle] = []
            var latitudeSum: QuadKeyDegrees = 0
            var longitudeSum: QuadKeyDegrees = 0
            
            var location: CLLocation {
                get {
                    return CLLocation(latitude: latitudeSum/CLLocationDegrees(articles.count), longitude: longitudeSum/CLLocationDegrees(articles.count))

            }
            var group: ArticleGroup
            let adjustedQuadKey: QuadKey
            let key: String
            if groupingPrecision < maxPrecision && (articleKeyToSelect == nil || article.key != articleKeyToSelect) {
                adjustedQuadKey = quadKey.adjusted(downBy: QuadKeyPrecision.maxPrecision - groupingPrecision)
                let baseQuadKey = adjustedQuadKey - adjustedQuadKey % 2
                key = "\(baseQuadKey)|\(baseQuadKey + 1)" // combine neighboring vertical keys
                group = groups[key] ?? ArticleGroup()
                group.baseQuadKey = baseQuadKey
                group.baseQuadKeyPrecision = groupingPrecision
            } else {
                group = ArticleGroup()
                adjustedQuadKey = quadKey
                key = "\(adjustedQuadKey)"
                group.baseQuadKey = quadKey
                group.baseQuadKeyPrecision = QuadKeyPrecision.maxPrecision
            }
            group.articles.append(article)
            let coordinate = QuadKeyCoordinate(quadKey: quadKey)
            group.latitudeSum += coordinate.latitude
            group.longitudeSum += coordinate.longitude
            groups[key] = group
        }
        
        greaterThanOneArticleGroupCount = 0
        let keys = groups.keys
        for quadKey in keys {
            guard var group = groups[quadKey] else {
                continue
            }
            if group.articles.count > 1 {
                let location = group.location
                let baseQuadKey = group.baseQuadKey
                let baseQuadKeyPrecision = group.baseQuadKeyPrecision
                let baseQuadKeyCoordinate = QuadKeyCoordinate(quadKey: baseQuadKey, precision: baseQuadKeyPrecision)
                
                if baseQuadKeyCoordinate.latitudePart > 2 && baseQuadKeyCoordinate.longitudePart > 1 {
                    for t: Int64 in -1...1 {
                        for n: Int64 in -1...1 {
                            guard t != 0 || n != 0 else {
                                continue
                            }
                            let latitudePart = QuadKeyPart(Int64(baseQuadKeyCoordinate.latitudePart) + 2*t)
                            let longitudePart = QuadKeyPart(Int64(baseQuadKeyCoordinate.longitudePart) + n)
                            //let adjacentBaseQuadKey = QuadKey(
                            let adjacentBaseQuadKey = QuadKey(latitudePart: latitudePart, longitudePart: longitudePart, precision: baseQuadKeyPrecision)
                            let adjacentKey = "\(adjacentBaseQuadKey)|\(adjacentBaseQuadKey + 1)"
                            guard let adjacentGroup = groups[adjacentKey] else {
                                continue
                            }
                            if let keyToSelect = articleKeyToSelect, adjacentGroup.articles.first?.key == keyToSelect {
                                //no grouping with the article to select
                                continue
                            }
                            let distance = adjacentGroup.location.distance(from: location)
                            if distance < groupingDistance {
                                group.articles.append(contentsOf: adjacentGroup.articles)
                                group.latitudeSum += adjacentGroup.latitudeSum
                                group.longitudeSum += adjacentGroup.longitudeSum
                                groups.removeValue(forKey: adjacentKey)
                            }
                        }
                    }
                }
                
                
            }

            var nextCoordinate: CLLocationCoordinate2D?
