     }
     
     
-    func loadPreviousPreviewImage(){
-        // load the asset image for the detail view
-        
-        
-        var previewPosition: Int = indexPosition - 1
-        
-        if(phAssetResult.count > 0){
-            
-            // did we reach the end of the list, then switch to the start
-            if(previewPosition < 0){
-                previewPosition = phAssetResult.count - 1
-            }
-            
-        }
-        
- 
-        
-        
-        let asset: PHAsset = getAsset(atIndex: previewPosition)
+    // generic function that loads an image for the requested asset
+    // add the requesting asset to load and provide an handler to use the image
+    func loadImage(asset: PHAsset, resultHandler: @escaping (UIImage?, [AnyHashable : Any]?) -> Void){
+        
         
         
         //let imageManager = PHCachingImageManager()
         let imageManager = PHImageManager()
-
+        
         var imageSize: CGSize
         
         let imageFrame = imageView.frame

            mapView!.setRegion(coordinateRegion, animated: true)
            
            

            
            // remove all old annotations
            mapView.removeAnnotations(mapView.annotations)

        
        let asset: PHAsset = getAsset(atIndex: previewPosition)

        loadImage(asset: asset, resultHandler: { imageResult, infoArray in

            if(imageResult == nil){
                print("============= error loading image =========================")
                return
            }
            
            self.imageView2.image = imageResult
        })
    }

    
    
    
    func showMapOverlay(){
        // MAP overlay display logic
        if (getAsset().location != nil){
            mapView.isHidden = false
            
