 				
 				return result;
 			}
+			
+			// For the other types, we know that coefficients only has 2 entries.
+			
+			//
 			else if (type == LOGARITHMIC) 
-			{	
-				return coefficients[0]*Math.log(xValue) + coefficients[1];
-			}
-				
-				
+			{					
+				return a*Math.log(xValue) + b;
+			}
+			
 			else if (type == EXPONENTIAL) 
 			{
-				return Math.exp(coefficients[0])*Math.exp(xValue*coefficients[1]);
+				trace(coefficients);
+				return Math.exp(b)*Math.exp(a*xValue);
+				//return Math.exp(coefficients[0])*Math.exp(xValue*coefficients[1]);
 			}
 			else if (type == POWER) 
 			{
-				return Math.exp(coefficients[0])*Math.pow(xValue, coefficients[1]);	
+				trace(coefficients);
+				return Math.exp(b) * Math.pow(xValue, a);	
 			}
 			else
 			{

			
			if (currentTrendline.value == POWER)
			{
				Rstring = "fit <- lm( log(y) ~ x )\n" 
					+"coef <- coefficients(fit)\n" 
					+"rSquared <- summary(fit)$r.squared\n";
			}

		 **/
		private function evalFunction(type:String, coefficients:Array, xValue:Number):Number
		{
				
			var b:Number = coefficients[0];
			var a:Number = coefficients[1];
			
			if (type == POLYNOMIAL) 
			{
