     
     /// Returns the layout attributes for all of the cells and views in the specified rectangle.
     override public func layoutAttributesForElementsInRect(rect: CGRect) -> [UICollectionViewLayoutAttributes]? {
-        let startSectionIndex = internalCachedCellSectionFromRectOffset(rect.origin)
+        let startSectionIndex = startIndexFrom(rectOrigin: rect.origin)
         
         // keep looping until there were no interception rects
         var attributes: [UICollectionViewLayoutAttributes] = []

        return val
    }
    
    func binarySearch<T: Comparable>(a: [T], key: T) -> Int {
        var range = 0..<a.count
        var midIndex: Int = 0
        while range.startIndex < range.endIndex {
            midIndex = range.startIndex + (range.endIndex - range.startIndex) / 2
            if midIndex + 1  >= a.count || key >= a[midIndex] && key < a[midIndex + 1] ||  a[midIndex] == key {
                return midIndex
            } else if a[midIndex] < key {
                range.startIndex = midIndex + 1
            } else {
                range.endIndex = midIndex

        }
    }
    
    func startIndexFrom(rectOrigin offset: CGPoint)-> Int {
        let key =  scrollDirection == .Horizontal ? offset.x : offset.y
        return startIndexBinarySearch(sectionSize, offset: key)
    }
    
    func sizeOfContentForSection(section: Int) -> CGFloat {
