         
         return current
     }
-    
+
+    /**
+     * Conveys essentially the same functionality as method **replaceAll**, but provides a transition animation showing that navigation stack is being emptied and replaced with new controller.
+     * - parameter controller: **UIViewController** which is supposed to replace the navigation stack
+     * - returns: Collection of popped controllers of type **UIViewController**.
+     * - NOTE: See **replaceAll**.
+     */
     @discardableResult
     public func popAllAndReplace(with controller: UIViewController) -> [UIViewController] {
         let transition = CATransition()

        
        return replaceAll(with: controller, animated: false)
    }
    
    @discardableResult
    public func replaceAll(with controller: UIViewController, animated: Bool = true) -> [UIViewController] {
        let currentControllers = viewControllers

import UIKit

extension UINavigationController {

    /**
     * Pushes controller onto the navigation stack.
     * - parameter controller: **UIViewController** to be pushed onto the stack
     * - parameter animated: determines whether the push should be animated
     */
    public func push(controller: UIViewController, animated: Bool = true) {
        pushViewController(controller, animated: animated)
    }

    /**
     * Pops controller from the navigation stack.
     * - parameter animated: determines whether the push should be animated
     * - returns: `Optional` **UIViewController**, `nil` if there was no controller on the stack
     */
    @discardableResult
    public func pop(animated: Bool = true) -> UIViewController? {
        return popViewController(animated: animated)
    }

    /**
     * Replaces the topmost controller on the navigation stack with **UIViewController** provided.
     * - parameter controller: **UIViewController** to replace the topmost controller on the stack
     * - parameter animated: determines whether the replacing should be animated
     * - returns: `Optional` **UIViewController**, `nil` if there was no controller on the stack
     */
    @discardableResult
    public func replace(with controller: UIViewController, animated: Bool = true) -> UIViewController? {
        var controllers = viewControllers
