     
     public func layoutDeck() {
         if !visibleCards.isEmpty {
-            let topCardFrame = frameForCardAtIndex(0)
             for (index, card) in visibleCards.enumerate() {
                 if index == 0 {
-                    card.frame = topCardFrame
+                    card.frame = frameForTopCard()
                     card.layer.transform = CATransform3DIdentity
                 } else {
-                    var currentCardFrame = frameForCardAtIndex(UInt(index))
-                    card.frame = topCardFrame
+                    let cardParameters = backgroundCardParametersForFrame(frameForCardAtIndex(UInt(index)))
                     
-                    let transform = CATransform3DIdentity
-                    let widthScale = currentCardFrame.width / topCardFrame.width
-                    let heightScale = currentCardFrame.height / topCardFrame.height
-                    card.layer.transform = CATransform3DScale(transform,  widthScale, heightScale, 1.0)
-
-                    currentCardFrame.size = topCardFrame.size
-                    card.frame = currentCardFrame
+                    let scale = cardParameters.scale
+                    card.layer.transform = CATransform3DScale(CATransform3DIdentity, scale.width, scale.height, 1.0)
+
+                    card.frame = cardParameters.frame
                 }
                 
             }

                }
                
                currentCard.userInteractionEnabled = false
                var currentCardFrame = frameForCardAtIndex(UInt(index))
                
                let widthScale = currentCardFrame.width / topCardFrame.width
                let heightScale = currentCardFrame.height / topCardFrame.height
                currentCardFrame.size = topCardFrame.size
                
                let scaleAnimation = POPBasicAnimation(propertyNamed: kPOPLayerScaleXY)
                scaleAnimation.duration = backgroundCardFrameAnimationDuration
                scaleAnimation.toValue = NSValue(CGSize: CGSize(width: widthScale, height: heightScale))
                currentCard.layer.pop_addAnimation(scaleAnimation, forKey: "scaleAnimation")
                
                let frameAnimation = POPBasicAnimation(propertyNamed: kPOPViewFrame)
                frameAnimation.duration = backgroundCardFrameAnimationDuration
                frameAnimation.toValue = NSValue(CGRect: currentCardFrame)
                currentCard.pop_addAnimation(frameAnimation, forKey: "frameAnimation")
            }
        }

                let lastCardOverlayView = dataSource.koloda(self, viewForCardOverlayAtIndex: UInt(shownCardsCount - 1))
                
                var lastCardFrame = frameForCardAtIndex(UInt(visibleCards.count))
                let cardParameters = backgroundCardParametersForFrame(lastCardFrame)

                let lastCardView = DraggableCardView(frame: cardParameters.frame)
                
                
                let scale = cardParameters.scale
                lastCardView.layer.transform = CATransform3DScale(CATransform3DIdentity, scale.width, scale.height, 1.0)
                
                lastCardView.hidden = true
                lastCardView.userInteractionEnabled = true
                
