         var node:GridRowNode = rowList.first;
         var numRows:int = 0;
         
-        while (node)
+        while (node && node.rowIndex < nRows)
         {
             height += node.maxCellHeight;
             numRows++;
             node = node.next;
         }
         
-        return height + ((nRows - numRows) * (defaultRowHeight) + (nRows - 1) * rowGap);
+        var contentHeight:Number = height + (nRows - numRows) * defaultRowHeight;
+        if (nRows > 1)
+            contentHeight += (nRows - 1) * rowGap;
+        
+        return contentHeight;
     }
     
     /**

     *  Returns the Y coordinate of the origin of the specified cell.
     */
    public function getCellY(row:int, col:int):Number
    {        // no cache so we use default heights for each row.
        if (!isNaN(fixedRowHeight))
            return row * (fixedRowHeight + rowGap);
        
        if (rowList.length == 0)
            return row * (defaultRowHeight + rowGap);
        
        var node:GridRowNode = rowList.first;
        var y:Number = 0;
        var index:int = 0;
        
        while (node)
        {
            // success case: row index is <= to node's index.
            if (row <= node.rowIndex)
            {
                y += (row - index) * (defaultRowHeight + rowGap);
                return y;
            }
            
            // otherwise, row index is > node's index
            
            // case if node index is much greater than current index.
            if (node.rowIndex > index)
            {
                y += (node.rowIndex - index) * (defaultRowHeight + rowGap);
                index += node.rowIndex - index; // index == node.rowIndex
            }
            
            // index is now equal to node's index but row index is > node's index so we add node.
            y += node.maxCellHeight;
            index++;
            node = node.next;
        }
        
        // no more nodes, so we just add the rest.
        y += (row - index) * (defaultRowHeight + rowGap);
        return y;
    }
    
    /**

     */
    public function insertRows(startRow:int, count:int):void
    {
        if (startRow < 0 || count <= 0)
            return;
        
        var node:GridRowNode = rowList.findNearest(startRow);
        
        // start on the index we're inserting at.
        if (node && node.rowIndex < startRow)
            node = node.next;
        while (node)
        {
            node.rowIndex += count;
            node = node.next;
        }
        
        this.rowCount += count;
        
        // cache is invalid now.
        recentNode = null;
        recentNode2 = null;
    }
    
    /**
