             
                 let action = UIAlertAction(title: viewControllerGreeting, style: UIAlertActionStyle.default, handler: { (alertAction) in
                     
-                    let viewController = self.viewControllerAtIndex(index)!
+                    let viewController = self.viewController(at: index)!
                     
                     let direction:EMPageViewControllerNavigationDirection = index > selectedIndex ? .forward : .reverse
                     

    }
    
    func em_pageViewController(_ pageViewController: EMPageViewController, viewControllerAfterViewController viewController: UIViewController) -> UIViewController? {
        if let viewControllerIndex = self.indexOfViewController(viewController as! GreetingViewController) {
            let afterViewController = self.viewControllerAtIndex(viewControllerIndex + 1)
            return afterViewController
        } else {
            return nil
        }
    }
    
    func viewControllerAtIndex(_ index: Int) -> GreetingViewController? {
        if (self.greetings.count == 0) || (index < 0) || (index >= self.greetings.count) {
            return nil
        }

        // If it wasn't successful, the selected view controller is the start view controller
        if transitionSuccessful {
            
            if (self.index(of: destinationViewController) == 0) {
                self.reverseButton.isEnabled = false
            } else {
                self.reverseButton.isEnabled = true
            }
            
            if (self.index(of: destinationViewController) == self.greetings.count - 1) {
                self.forwardButton.isEnabled = false
            } else {
                self.forwardButton.isEnabled = true
