 
         # Expand (or collapse) a row
         expand = (info) ->
-          if expanded == info.i && expandedCat == info.c
+          if expanded?.i == info.i && `expanded.c == info.c`
             if info.t == 'more'
               collapse()
             return
           collapse()
 
-          expanded = info.i
-          expandedCat = info.c
-          row = Rows[expanded]
-          row.classList.add('expand')
-
-          max = Counts[expanded][expandedCat]
-          max++ if Editing && !info.category.fixed
+          expanded = new Info()
+          expanded.i = info.i
+          expanded.c = info.c
+          info.row.classList.add('expand')
+
+          max = expanded.count
+          max++ if Editing && !expanded.category.fixed
           return if max <= 1
-          next = row.nextSibling
-          start = Counts[expanded][expandedCat] == 1
+          next = info.row.nextSibling
+          start = expanded.count == 1
           for n in [+start..max-1] by 1
-            info.row = TBody.insertBefore(document.createElement('tr'), next)
-            info.row.data = expanded
-            info.row.className = 'expand'
-            info.n = n
-            generateRecord(info)
+            expanded.n = n
+            expanded.row = TBody.insertBefore(document.createElement('tr'), next)
+            expanded.row.data = expanded.i
+            expanded.row.className = 'expand'
+            generateRecord(expanded)
+          expanded.row = info.row
 
           max++ unless start
-          el = row.firstChild
+          el = info.row.firstChild
           while el
             info = new Info(el)
-            if `info.c != expandedCat`
+            if `info.c != expanded.c`
               el.setAttribute("rowspan", max)
             el = el.nextSibling
           return

              add("Remove " + info.record.displayName + " from this session",
                (info) -> setRecord(info, null),
                true)
          if !info.r || input && input != info.record.measures[info.metric.id]
            inputl = (input ? '').toLowerCase()
            set = (r) -> (info) ->
              setRecord(info, r)

          return

        generateMultiple = (info) -> # (col, cols, row, i, n, t) ->
          t = info.count
          return if (if info.hasOwnProperty('n') then info.n < t else t == 1)
          td = info.row.appendChild(document.createElement('td'))
          width = info.cols.metrics.length
          td.setAttribute("colspan", width)
          if info.hasOwnProperty('n') || t <= 1
            td.className = 'null'
            if !info.n || info.n == t
              if Editing && width > 1
