             case .All:
                 return g.next()!
             case .SingleValue(let sv):
-                return sv
+                return sv + g.next()!
             case .Range(let low, _):
                 return low + g.next()!
             case .List(let list):

    // Bounds check indicies
    guard pairs.map({$1.isInbounds($0)}).filter({$0 == false}).isEmpty else { return nil }
    
    let shape = pairs.flatMap { (initialBound, index) -> Int? in
        switch index {
        case .All:
            return initialBound
        case .SingleValue:
            return nil // Compress shape by removing extranious 1s
        case .List(let list):
            return list.count
        case .Range(let low, let high):

// Ugly functions get ugly names.
// The returned subarrays represent each possible combination of values from 0 to the bound for that place in the initial array.
private func enumerateAllValuesFromZeroToBounds(bounds: [Int]) -> [[Int]] {
    func recursivelyEnumerateAllValuesFromZeroToBounds(bounds: Swift.ArraySlice<Int>) -> [[Int]] {
        guard let first = bounds.first else { return [[]] }
        
        let results = recursivelyEnumerateAllValuesFromZeroToBounds(bounds.dropFirst())
        
        return (0..<first).map { currentIndex -> [[Int]] in
            return results.map { [currentIndex] + $0 }
