             let headerOrigin = headerCache[attributes.indexPath.section].frame.origin.y
             stride += headerSize + headerOrigin
         } else { // If there are no headers then alll the cells will have the same height, therefore the strides will have the same height
-            let sectionHeight = itemSize.height * CGFloat(numberOfRows)
-            stride = CGFloat(attributes.indexPath.section) * sectionHeight
+            
+            stride = scrollDirection == .Horizontal ?
+                 CGFloat(attributes.indexPath.section) * itemSize.width * CGFloat(numberOfColumns):
+                CGFloat(attributes.indexPath.section) * itemSize.height * CGFloat(numberOfRows)
         }
         
         var xCellOffset : CGFloat = CGFloat(attributes.indexPath.item % 7) * self.itemSize.width

        if attributes.representedElementKind != nil { return }
        guard let collectionView = self.collectionView else { return }
    
        if let itemHeight = delegate!.itemSize {
            itemSize.height = itemHeight
        } else {
            let sizeOfItem = sizeForitemAtIndexPath(attributes.indexPath)
            itemSize.height = sizeOfItem.height
        }
        
        var stride: CGFloat = 0

                        
                        if scrollDirection == .Vertical {
                            contentHeight += (attribute.frame.height * CGFloat(numberOfRows))
                        } else {
                            contentWidth += (attribute.frame.width * CGFloat(numberOfColumns))
                        }
                    }
                    cellCache[section]!.append(attribute)
                }
            }

        }
        
        if scrollDirection == .Horizontal {
//            contentWidth = self.collectionView!.bounds.size.width * CGFloat(numberOfMonthsInCalendar * numberOfSectionsPerMonth)
            contentHeight = self.collectionView!.bounds.size.height
        } else {
            contentWidth = self.collectionView!.bounds.size.width
