     // parition the widths in to rows using dynamic programming O(n^2)
     private func partition(values: [Float], max:Float) -> [[Float]] {
         var numValues = values.count
+        if numValues == 0 {
+            return []
+        }
         
         var slacks = [[Float]](count: numValues, repeatedValue: [Float](count: numValues, repeatedValue: Float.infinity))
         for var from=0; from<numValues; from++ {

    override func collectionViewContentSize() -> CGSize {
        return contentSize
    }

    // MARK: - UICollectionViewLayout Helpers
    private func collectionView(collectionView:UICollectionView, frameForHeader isForHeader:Bool, inSection section:Int, inout updateContentSize contentSize:CGSize) -> CGRect {
        var size = referenceSizeForHeader(isForHeader, inSection: section), frame = CGRectZero

    private var contentSize = CGSizeZero
    
    // TODO: shouldInvalidateLayoutForBoundsChange
    
    // MARK: - UICollectionViewLayout
    override func prepareLayout() {
        resetItemFrames()
