 					{
 						return _count/(_sortedValues.length+1);
 					}
-					var i3:Number = _count - _m +1;
-					var val:Number = _sortedValues[i3-1];
+					// `III` originally
+					var lower_class_limit:Number = _count - _m +1;
+					var val:Number = _sortedValues[lower_class_limit-1];
 					
-					_s2 += val * val;
-					_s1 += val;
+					_sum_squares += val * val;
+					_sum += val;
 					
+					// here we're estimating variance for each potential classing
+					// of the data, for each potential number of classes. `w`
+					// is the number of data points considered so far.
 					_w += 1;
-					_v = _s2 - (_s1 * _s1) / _w;
-					var i4:Number= i3 -1;
+					
+					// the variance at this point in the sequence is the difference
+					// between the sum of squares and the total x 2, over the number
+					// of samples.					
+					_variance = _sum_squares - (_sum * _sum) / _w;
+					
+					var i4:Number= lower_class_limit -1;
 					if(i4 !=0)
 					{
 						_p = 2;
 						for (; _p < numOfBins.value + 1; _p++)
 						{
-							
-							if((_mat2[_count][_p]) >= (_v + _mat2[i4][_p-1]))
+							// if adding this element to an existing class
+							// will increase its variance beyond the limit, break
+							// the class at this point, setting the lower_class_limit
+							// at this point.
+							if((_variance_combinations[_count][_p]) >= (_variance + _variance_combinations[i4][_p-1]))
 							{
-								_mat1[_count][_p] = i3;
-								_mat2[_count][_p] = _v +_mat2[i4][_p-1];
+								_lower_class_limits[_count][_p] = lower_class_limit;
+								_variance_combinations[_count][_p] = _variance +_variance_combinations[i4][_p-1];
 							}
 						}
 					}
 				}
 				_m = 0;
-				_mat1[_count][1] = 1;
-				_mat2[_count][1] = _v;
+				_lower_class_limits[_count][1] = 1;
+				_variance_combinations[_count][1] = _variance;
 			}
 			return 1;
 		}

				kClass.push(0);
			}
			
			//this is the last number in the array
			kClass[countNum] = _sortedValues[_sortedValues.length -1];
			
			//this is the first numer in the array 
			kClass[0] = _sortedValues[0];
			
			
			
			while (countNum >=2)
			{
				var id:Number = _mat1[kClassCount][countNum] -2;
				kClass[countNum -1] = _sortedValues[id];
				kClassCount = _mat1[kClassCount][countNum] -1;
				// spits out the rank and value of the break values:
				// console.log("id="+id,"rank = " + String(mat1[k][countNum]),"val =
				// " + String(dataList[id]))
				// count down:
				countNum --;
			}
			

		
		private var _previousSortedValues:Array = [];
		private var _sortedValues:Array = [];
		
		private var _count:int = 2;
		private var _m:Number = 0;
		private var _p:Number = 2;
		
		// the variance, as computed at each step in the calculation
		private var _variance:Number = 0;
		
		// `SZ` originally. this is the sum of the values seen thus
		// far when calculating variance.
		private var _sum:Number = 0;
		
		// `ZSQ` originally. the sum of squares of values seen
		// thus far
		private var _sum_squares:Number = 0;
		// `WT` originally
		private var _w:Number = 0;
		
		
		private function _iterateJenksBreaks(returnTime:int):Number
		{
			// Compute the matrices required for Jenks breaks.
			for (; _count < _sortedValues.length + 1; _count++)
			{
				if(_m==0)
				{
					_sum= 0;
					_sum_squares= 0;
					_w= 0;
					_m =1;			
				}
