 
 import Foundation
 
+
 protocol KSICCoordinator: class {
+    
+    /// The carousel that being show on screen
     var carousel: KSICImageScrollerViewController? { get }
+    
+    /// The model (images that need to be show on carousel)
     var model: [KSImageCarouselDisplayable] { get }
+    
+    /// View model for the carousel, this array will always have 3 elements.
+    /// The 3 elements consists of [prev page element, current page element, next page element]
+    /// nil in carouselViewModel indicates that no more data to show and carousel will not be able to scroll to next page / previous page anymore
     var carouselViewModel: [KSImageCarouselDisplayable?] { get }
+    
+    /// Current page of the carousel
     var currentPage: Int { get }
     
+    /// Add the carousel to it's container
     func showCarousel()
+    
+    /// Go to next page
     func nextPage()
+    
+    /// Go to previous page
     func previousPage()
 }
 

            //                carousel?.viewModelDidChanged?(vm)
        }
    }
    var currentPage: Int {
        return _currentPage
    }

        }
    }
    
    // MARK: KSICCoordinator conformation
    public func showCarousel() {
        //        let vm = viewModel(forPage: currentPage)
        _carousel = KSICImageScrollerViewController()
        //        carousel.delegate = self
    }

    func nextPage() {
        if currentPage == lastPage {
            return
        } else {
            let newPage = currentPage + 1
            try! goto(page: newPage)
        }
    }
    
    func previousPage() {
        if currentPage == firstPage {
            return
        } else {
            let newPage = currentPage - 1
            try! goto(page: newPage)
        }
    }
    
    // MARK: Private functions
    
    /// Go to a specific page
    ///
    /// - Parameter p: page number
    /// - Throws: pageOutOfRange
    private func goto(page p: Int) throws {
        
        // Make sure page is between first page and last page
