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

        return viewController
    }
    
    func indexOfViewController(_ viewController: GreetingViewController) -> Int? {
        if let greeting: String = viewController.greeting {
            return self.greetings.index(of: greeting)
        } else {

    // MARK: - EMPageViewController Data Source
    
    func em_pageViewController(_ pageViewController: EMPageViewController, viewControllerBeforeViewController viewController: UIViewController) -> UIViewController? {
        if let viewControllerIndex = self.index(of: viewController as! GreetingViewController) {
            let beforeViewController = self.viewController(at: viewControllerIndex - 1)
            return beforeViewController
        } else {
            return nil
