             // next image
             if(velX > 1000){
                 
+                isImageTransition = true
+                
                 // reset the preview mode since we are loading a new image
                 previewMode = previewStates.none
                 
+                // move the preview image into focus
+                // remove old dynamic behaviour
+                if let behaviour=attachment2{
+                    animator?.removeBehavior(behaviour)
+                }
+                
+                // snap back also the preview image
+                // default case - just snap back
+                snap2 = UISnapBehavior(item: imageView2, snapTo: CGPoint(x: screenWidth / 2, y: screenHeight / 2 ))
+                snap2?.damping =  2
+                animator?.addBehavior(snap2!)
+                
+                // reset the preview mode since we are loading a new image
+                previewMode = previewStates.none
+                ///////////////////////////////////////
+                
+                
                 print("speed reached")
-                let gravity = UIGravityBehavior(items: [imageView])
+                gravity = UIGravityBehavior(items: [imageView])
                 
                 
            
-                gravity.gravityDirection = CGVector(dx: velX / 100, dy: velY / 100)
-                
-                animator?.addBehavior(gravity)
+                gravity?.gravityDirection = CGVector(dx: velX / 100, dy: velY / 100)
+                
+                animator?.addBehavior(gravity!)
                
                 
                 // append an action to the gravity
                 // to observe if the image was moved 
                 // off the visible screen and can be replaced by the previous image
-                gravity.action = { _ in
-                    if (self.imageView.center.x > CGFloat(self.screenWidth * 2) ){
+                gravity!.action = { _ in
+                    if (self.imageView.center.x > CGFloat(self.screenWidth * 12) ){
                         print("off screen for previous image")
+                        
+                        
                         self.animator?.removeAllBehaviors()
+                        
                         self.isZoomMode = false;
                         self.loadPreviousImage()
                  

    var attachment: UIAttachmentBehavior?
    var attachment2: UIAttachmentBehavior?
    
    var snap: UISnapBehavior?
    var snap2: UISnapBehavior?
    

    var previewMode: previewStates = previewStates.none
    
    
    // is the image being changed to the next/last image
    // please do not dusturb the rendering
    var isImageTransition:Bool = false
    
    
    
    // current asset list to be iterated through
    var phAssetResult: PHFetchResult<PHAsset>!
    
