     
     private func configureCloseButton() {
         
-        closeButton.addTarget(self, action: "close", forControlEvents: .TouchUpInside)
+        closeButton?.addTarget(self, action: "close", forControlEvents: .TouchUpInside)
     }
     
     func createViewHierarchy() {
         
-        self.view.addSubview(closeButton)
+        if let close = closeButton {
+
+            self.view.addSubview(close)
+        }
     }
     
     func configureHeaderView() {

public class GalleryViewController : UIPageViewController, UIViewControllerTransitioningDelegate, ImageViewControllerDelegate  {
    
    //UI
    private var closeButton: UIButton!
    public var headerView: UIView?
    public var footerView: UIView?
    

    public override func viewDidLayoutSubviews() {
        super.viewDidLayoutSubviews()
        
        closeButton?.frame.origin = CGPoint(x: self.view.frame.size.width - closeButton!.frame.size.width - closeButtonPadding, y: closeButtonPadding)
        
        layoutHeaderView()
        layoutFooterView()
