             }
         }()
         
-        for (index, itemView) in itemViews.enumerate() {
+        for itemView in itemViews {
             transformView.insertSubview(itemView, atIndex: 0)
             itemView.frame.size = CGSize(width: 300, height: 500) // TODO: change hardcoded values
             
             let panGesture = UIPanGestureRecognizer(target: self, action: #selector(viewWasPanned))
             itemView.addGestureRecognizer(panGesture)
             panGesture.enabled = true
-            
-             // TODO: remove this? useful for debugging
-            itemView.tag = index + 1
-            print("tag: \(itemView.tag), view: \(itemView)")
         }
         
         layoutItemViews()
     }
     
-    private func shiftItemViews(byOffset offset: CGFloat) {
+    private func viewDidPanHorizontally(view: UIView, byOffset offset: CGFloat) {
         // TODO: clean this up
         
-        rootOffset += offset
+        // Calculate the new x origin point for the view that was panned.
+        // Then use that value to backwards calculate the new root offset
+        // based on the view that was actually panned. This allows us to 
+        // keep the currently "selected" view under the user's finger 
+        // while it's being panned, but still allow for the other card
+        // animations to behave properly
+        // TODO: some better way to abstract this. If a value below changes it
+        //       needs to change here as well
+        let viewIndex = itemViews.indexOf(view)!
+        let nextViewXPoint = viewPositions[view]!.x + offset
+        rootOffset = (2.5 * log2(nextViewXPoint)) * 10 + (CGFloat(viewIndex) * 50)
         
         for (index, itemView) in itemViews.enumerate() {
             var transform = CATransform3DIdentity

            transform = CATransform3DTranslate(transform, point.x, point.y, point.z)
            
            itemView.layer.transform = transform
            viewPositions[index] = point
        }
    }
    

                velocityX += force * timeDelta
                let offset = velocityX * timeDelta
                
                self.viewDidPanHorizontally(gesturedView, byOffset: CGFloat(offset))
                
                print("force: \(force), time: \(timeDelta), offset: \(offset), speed: \(velocityX)")

