         }
         
         backgroundView.removeFromSuperview()
-        presentingViewSnapshotView.removeFromSuperview()
+        snapshotView?.removeFromSuperview()
+        snapshotViewContainer.removeFromSuperview()
         roundedViewForPresentingView.removeFromSuperview()
         
         let offscreenFrame = CGRect(x: 0, y: containerView.bounds.height, width: containerView.bounds.width, height: containerView.bounds.height)

        
        roundedViewForPresentingView.cornerRadius = Constants.cornerRadius * scaleForPresentingView
        
        snapshotViewTopConstraint = presentingViewSnapshotView.topAnchor.constraint(equalTo: containerView.topAnchor, constant: topInset)
        snapshotViewWidthConstraint = presentingViewSnapshotView.widthAnchor.constraint(equalTo: containerView.widthAnchor, multiplier: scaleForPresentingView)
        snapshotViewAspectRatioConstraint = presentingViewSnapshotView.widthAnchor.constraint(equalTo: presentingViewSnapshotView.heightAnchor, multiplier: aspectRatio)
        
        snapshotViewTopConstraint?.isActive = true
        snapshotViewWidthConstraint?.isActive = true

        presentedViewController.transitionCoordinator?.animate(
            alongsideTransition: { [unowned self] context in
                self.presentAnimation?()
                self.snapshotView?.transform = transformForSnapshotView
                self.roundedViewForPresentingView.cornerRadius = Constants.cornerRadius
                self.roundedViewForPresentingView.transform = transformForSnapshotView
                self.roundedViewForPresentingView.backgroundColor = UIColor.black.withAlphaComponent(1 - Constants.alphaForPresentingView)
            }, completion: { _ in
                self.snapshotView?.transform = .identity
                rootSnapshotView?.removeFromSuperview()
                rootSnapshotRoundedView?.removeFromSuperview()
            }
