             currentViewController.removeFromParentViewController()
             currentViewController.view.removeFromSuperview()
             currentViewController.didMoveToParentViewController(nil)
+            removeBehavioursForCurrentController()
         }
         
         currentViewController = delegate.viewControllerAtIndex(index)

            addChildViewController(currentViewController)
            view.addSubview(currentViewController.view)
            currentViewController.didMoveToParentViewController(self)
        }
        
        index++
    }
    
    func checkForLastViewController() {

            self.presentingViewController?.dismissModalViewControllerAnimated(true)
        }
    }
    
    func userDidPan(panRecognizer: UIPanGestureRecognizer) {
        // Many thanks to https://github.com/u10int/URBMediaFocusViewController
        let location = panRecognizer.locationInView(self.view)
        let boxLocation = panRecognizer.locationInView(self.currentViewController!.view)
        
        if (panRecognizer.state == .Began) {
            animator.removeBehavior(snapBehaviour)
            animator.removeBehavior(pushBehaviour)
            let centerOffset = UIOffsetMake(boxLocation.x - CGRectGetMidX(self.currentViewController!.view.bounds), boxLocation.y - CGRectGetMidY(self.currentViewController!.view.bounds));
            attachmentBehaviour = UIAttachmentBehavior(item: self.currentViewController!.view, offsetFromCenter: centerOffset, attachedToAnchor: location)
            animator.addBehavior(attachmentBehaviour)
        } else if (panRecognizer.state == .Changed) {
            attachmentBehaviour!.anchorPoint = location
        } else if (panRecognizer.state == .Ended) {
            animator.removeBehavior(attachmentBehaviour)
            attachmentBehaviour = nil
            
            let runningOnPad = UIDevice.currentDevice().userInterfaceIdiom == .Pad
            // need to scale velocity values to tame down physics on the iPad
            let deviceVelocityScale = runningOnPad ? 0.2 : 1.0
            let deviceAngularScale = runningOnPad ? 0.7 : 1.0
            // factor to increase delay before `dismissAfterPush` is called on iPad to account for more area to cover to disappear
            let deviceDismissDelay = runningOnPad ? 1.8 : 1.0
            let velocity = panRecognizer.velocityInView(view)
            let velocityAdjust = 10.0 * deviceVelocityScale
            
            
            let minimumVelocityRequiredForPush = 50.0
            
            animator.addBehavior(snapBehaviour)
            animator.addBehavior(pushBehaviour)
        }
    }
}
