         super.viewDidLoad()
         
         self.dataSource = self
+        
+        if let stop = stop {
+            allStopContent = stop.stopPictures + (stop.youTubes ?? [])  // ?? is nil coalescing
+            // operator - If stop.youTubes is not nil it is unwrapped, otherwise the empty array is
+            // returned
+        }
+        
         let firstVC = viewControllerAtIndex(0)
         setViewControllers([firstVC!], direction: .Forward, animated: true, completion: nil)
         

    
    func pageViewController(pageViewController: UIPageViewController, viewControllerAfterViewController viewController: UIViewController) -> UIViewController? {
        
        guard let stop = stop else {return nil}
        
        let stopContentVC = viewController as! PictureContentViewController
        pageIndex = stopContentVC.pageIndex + 1
       
        if pageIndex > (stop.stopPictures.count) - 1 {
            pageIndex = (stop.stopPictures.count) - 1
            return nil
        } else {
            return viewControllerAtIndex(pageIndex)
            
        }
    }
    


    
}

        // Dispose of any resources that can be recreated.
    }
    
    func viewControllerAtIndex(index: Int) -> UIViewController? {
        
        guard allStopContent.count > 0 else {
            let stopContentVC = storyboard?.instantiateViewControllerWithIdentifier("stopContentVC") as! PictureContentViewController
            stopContentVC.picText = "No Stop Selected"
            
            return stopContentVC
        }
        
        if let _ = (allStopContent[index])["picImage"]  {
            let stopContentVC = storyboard?.instantiateViewControllerWithIdentifier("stopContentVC") as! PictureContentViewController
            if let _ = stop {
                
                stopContentVC.delegate = self
                stopContentVC.picImageFileName = (allStopContent[index])["picImage"]!
                stopContentVC.picText = (allStopContent[index])["picText"]!
                stopContentVC.maxPages = allStopContent.count
                
                
            } else {
                stopContentVC.picText = "No Stop Selected"
            }
            stopContentVC.pageIndex = index
            return stopContentVC
        }else {
            let youTubeContentVC = storyboard?.instantiateViewControllerWithIdentifier("YouTubeVC") as! YouTubeContentViewController
            
            youTubeContentVC.delegate = self
            youTubeContentVC.maxPages = allStopContent.count
            youTubeContentVC.pageIndex = index
            
            youTubeContentVC.youTubeID = (allStopContent[index])["YouTubeID"]!
            youTubeContentVC.youTubeText = (allStopContent[index])["YouTubeText"]!
            return youTubeContentVC
        }
        
    }
    
