         
         self.mapView.setRegion(region, animated: true)
     }
-  
-    // populating stores as annotations in the mapView    
+    
     func populateStoreAnnotations() {
         
-        if stores != nil {
+        for store in storesInMapView {
             
-            for store in stores! {
-                
-                if store != nil {
-                    
-                    guard let storeName = store.storeName as? String else { return }
-                    let address = store.address.allValues
-                    let location = store.location
-                    
-                    let latitude = location.latitude
-                    let longitude = location.longitude
-                    
-                    let annotation = MKPointAnnotation()
-                    
-                    annotation.coordinate.latitude = latitude as! CLLocationDegrees
-                    annotation.coordinate.longitude = longitude as! CLLocationDegrees
-                    
-                    annotation.title = storeName
-                    mapView.addAnnotations([annotation])
-                  
-                }
-              
-            }
+            let storeName = store.storeName
+            let address = store.address.allValues
+            let location = store.location
+            
+            let latitude = location.latitude
+            let longitude = location.longitude
+            
+            let annotation = MKPointAnnotation()
+            
+            annotation.coordinate.latitude = latitude
+            annotation.coordinate.longitude = longitude
+            
+            annotation.title = storeName
+            mapView.addAnnotations([annotation])
             
         }
         

        
        SearchStores.searchForStoresLocations(near: coordinate, with: distanceInMeters) { stores in
            
            print("mapView distance is : \(self.distance)")
            
            self.stores = stores
            
            self.populateStoreAnnotations()
            

        
    }
    
    
    func mapView(_ mapView: MKMapView, annotationView view: MKAnnotationView, calloutAccessoryControlTapped control: UIControl) {
        
        view.setSelected(true, animated: true)
        
    }
    
    func getDirections() {
        
        if let selectedPin = selectedPin {
