         if attributes.representedElementKind != nil { return }
         guard let collectionView = self.collectionView else { return }
     
-        if let itemHeight = delegate!.itemSize {
-            itemSize.height = itemHeight
+        
+        if let itemSize = delegate!.itemSize {
+            if scrollDirection == .Vertical { self.itemSize.height = itemSize } else { self.itemSize.width = itemSize}
         } else {
             let sizeOfItem = sizeForitemAtIndexPath(attributes.indexPath)
             itemSize.height = sizeOfItem.height
+            // jt101 the width is already set form the outside. may change this to all inside here.
         }
         
         var stride: CGFloat = 0

        
         // Generate and cache the headers
        for section in 0..<maxSections {
            
            if headerViewXibs.count > 0 {
                // generate header views
                let sectionIndexPath = NSIndexPath(forItem: 0, inSection: section)
                if let aHeaderAttr = layoutAttributesForSupplementaryViewOfKind(UICollectionElementKindSectionHeader, atIndexPath: sectionIndexPath) {
                    headerCache.append(aHeaderAttr)
                    
                    if scrollDirection == .Vertical {
                        contentHeight += aHeaderAttr.frame.height
                    }
                }
            }
            

                        
                        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
