      */
     private function measureReal(layoutTarget:GroupBase):void
     {
-        var layoutEltCount:int = layoutTarget.numElements;
-        var reqEltCount:int = requestedColumnCount; // -1 means "all elements"
-        var eltCount:uint = Math.max(reqEltCount, layoutEltCount);
-        var eltInLayoutCount:uint = 0; // elts that have been measured
-
-        var preferredHeight:Number = 0; // max of the elt preferred heights
-        var preferredWidth:Number = 0;  // sum of the elt preferred widths
-        var minHeight:Number = 0; // max of the elt minimum heights
-        var minWidth:Number = 0;  // sum of the elt minimum widths
-
+        var size:SizesAndLimit = new SizesAndLimit();
+        var justify:Boolean = verticalAlign == VerticalAlign.JUSTIFY;
+        var numElements:int = layoutTarget.numElements; // How many elements there are in the target
+        var numElementsInLayout:int = numElements;      // How many elements have includeInLayout == true, start off with numElements.
+        var requestedColumnCount:int = this.requestedColumnCount;
+        var columnsMeasured:int = 0;                    // How many columns have been measured
+        
+        var preferredHeight:Number = 0; // sum of the elt preferred heights
+        var preferredWidth:Number = 0;  // max of the elt preferred widths
+        var minHeight:Number = 0;       // sum of the elt minimum heights
+        var minWidth:Number = 0;        // max of the elt minimum widths
+        
         var fixedColumnWidth:Number = NaN;
         if (!variableColumnWidth)
             fixedColumnWidth = columnWidth;  // may query typicalLayoutElement, elt at index=0
-
-        for (var i:uint = 0; i < eltCount; i++)
-        {
-            if (i < layoutEltCount) // target.numElements
-                var elt:ILayoutElement = layoutTarget.getElementAt(i);
-            else // target.numElements < requestedElementCount, so "pad"
-                elt = typicalLayoutElement;
-            if (!elt || !elt.includeInLayout)
+        
+        var element:ILayoutElement;
+        for (var i:int = 0; i < numElements; i++)
+        {
+            element = layoutTarget.getElementAt(i);
+            if (!element || !element.includeInLayout)
+            {
+                numElementsInLayout--;
                 continue;
-                
+            }
+            
             // Consider the height of each element, inclusive of those outside
             // the requestedColumnCount range.
-            var height:Number = Math.ceil(elt.getPreferredBoundsHeight());
-            preferredHeight = Math.max(preferredHeight, height);
-            var flexibleHeight:Boolean = !isNaN(elt.percentHeight) || verticalAlign == VerticalAlign.JUSTIFY;
-            minHeight = Math.max(minHeight, flexibleHeight ? Math.ceil(elt.getMinBoundsHeight()) : height);
-            
-            // If requestedColumnCount is specified, no need to consider the width
-            // of cols outside the bounds of the "requested" range. Otherwise, we
-            // consider each element.
-            if ((reqEltCount == -1) || ((reqEltCount != -1) && eltInLayoutCount < requestedColumnCount))
+            getElementHeight(element, justify, size);
+            preferredHeight = Math.max(preferredHeight, size.preferredSize);
+            minHeight = Math.max(minHeight, size.minSize);
+
+            // Can we measure the width of this column?
+            if (requestedColumnCount == -1 || columnsMeasured < requestedColumnCount)
             {
-                var width:Number = isNaN(fixedColumnWidth) ? elt.getPreferredBoundsWidth() : fixedColumnWidth;
-                width = Math.ceil(width); // Round up to give it a whole pixel.
-                preferredWidth += width;
-                minWidth += (isNaN(elt.percentWidth)) ? width : Math.ceil(elt.getMinBoundsWidth());
-                eltInLayoutCount += 1;
+                getElementWidth(element, fixedColumnWidth, size);
+                preferredWidth += size.preferredSize;
+                minWidth += size.minSize;
+                columnsMeasured++;
             }
         }
-        
-        if (eltInLayoutCount > 1)
+
+        // Calculate the total number of columns to measure
+        var columnsToMeasure:int = (requestedColumnCount != -1) ? requestedColumnCount : 
+                                                                  Math.max(requestedMinColumnCount, numElementsInLayout);
+        // Do we need to measure more columns?
+        if (columnsMeasured < columnsToMeasure)
+        {
+            // Use the typical element
+            element = typicalLayoutElement;
+            if (element)
+            {
+                // Height
+                getElementHeight(element, justify, size);
+                preferredHeight = Math.max(preferredHeight, size.preferredSize);
+                minHeight = Math.max(minHeight, size.minSize);
+    
+                // Width
+                getElementWidth(element, fixedColumnWidth, size);
+                preferredWidth += size.preferredSize * (columnsToMeasure - columnsMeasured);
+                minWidth += size.minSize * (columnsToMeasure - columnsMeasured);
+                columnsMeasured = columnsToMeasure;
+            }
+        }
+        
+        // Add gaps
+        if (columnsMeasured > 1)
         { 
-            var hgap:Number = gap * (eltInLayoutCount - 1);
+            var hgap:Number = gap * (columnsMeasured - 1);
             preferredWidth += hgap;
             minWidth += hgap;
         }
-
+        
         var hPadding:Number = paddingLeft + paddingRight;
         var vPadding:Number = paddingTop + paddingBottom;
         

        {
            var typicalWidth:Number = typicalElt.getPreferredBoundsWidth();
            var typicalHeight:Number = typicalElt.getPreferredBoundsHeight();
            llv.minorSize = Math.max(llv.minorSize, typicalHeight);
            llv.defaultMajorSize = typicalWidth;
        }
        if (layoutTarget)

            return;
                               
        _requestedColumnCount = value;
        
        if (target)
            target.invalidateSize();
    }    
    
    //----------------------------------
