     
     public var presentingTabBar: UITabBar? = nil
     
-    public var presentingViewController: UIViewController? = nil
-
+    public lazy var presentingViewController: UIViewController = {
+        return UIApplication.sharedApplication().keyWindow!.rootViewController!
+    }()
+    
+    
+    // MARK: - Callbacks
+    
+    /// A photo was selected
+    public var didGetPhoto: ((photo: UIImage, info: [NSObject : AnyObject]) -> Void)?
+    
+    /// A video was selected
+    public var didGetVideo: ((video: NSURL, info: [NSObject : AnyObject]) -> Void)?
+    
+    /// The user selected did not attempt to select a photo
+    public var didDeny: (() -> Void)?
+    
+    /// The user started selecting a photo or took a photo and then hit cancel
+    public var didCancel: (() -> Void)?
+    
+    /// A photo or video was selected but the ImagePicker had NIL for EditedImage and OriginalImage
+    public var didFail: (() -> Void)?
+    
+    
     // MARK: - Localization overrides
-
+    
     /// Custom UI text (skips localization)
     public var takePhotoText: String? = nil
-
+    
     /// Custom UI text (skips localization)
     public var takeVideoText: String? = nil
-
+    
     /// Custom UI text (skips localization)
     public var chooseFromLibraryText: String? = nil
-
+    
     /// Custom UI text (skips localization)
     public var chooseFromPhotoRollText: String? = nil
-
+    
     /// Custom UI text (skips localization)
     public var cancelText: String? = nil
-
+    
     /// Custom UI text (skips localization)
     public var noSourcesText: String? = nil
-
+    
+    
+    // MARK: - String constants
+    
     private let kTakePhotoKey: String = "takePhoto"
     
     private let kTakeVideoKey: String = "takeVideo"

    
    public var allowSelectFromLibrary = true
    
    public var allowEditing = true
    
    public var defaultToFrontCamera = false
    

            } else if let originalImage = info[UIImagePickerControllerOriginalImage] as? UIImage {
                imageToSave = originalImage
            } else {
                self.didCancel?()
                return
            }
            self.didGetPhoto?(photo: imageToSave, info: info)
            if UI_USER_INTERFACE_IDIOM() == .Pad {
                self.popover.dismissPopoverAnimated(true)
            }
        } else if mediaType == kUTTypeMovie as String {
            self.didGetVideo?(video: info[UIImagePickerControllerMediaURL] as! NSURL, info: info)
        }
        
        picker.dismissViewControllerAnimated(true, completion: nil)
        self.imagePicker = nil
    }
