 				if (currentTrendline.value == POLYNOMIAL)
 				{
 					coefficients = ((RresultArray[0] as RResult).value as Array != coefficients) ? (RresultArray[0] as RResult).value as Array : null;
-					getCallbackCollection(this).triggerCallbacks();	
-				}
-				
-				if (currentTrendline.value == EXPONENTIAL)
-				{
-					
-				}
-				
-				if (currentTrendline.value == POWER)
-				{
-					
-				}
-				
-				if (currentTrendline.value == LOGARITHMIC)
-				{
-					
-					
-				}
-			}
-		}
-		
-		private function handleLinearRegressionFault(event:FaultEvent, token:Object = null):void
-		{
-			if (this.requestID != int(token))
-			{
-				// ignore outdated results
-				return;
-			}
-			
-			reportError(event);
-			intercept = NaN;
-			slope = NaN;
-			coefficients = null;
-			getCallbackCollection(this).triggerCallbacks();
-		}
-		
-		public function getSlope():Number { return slope; }
-		public function getIntercept():Number { return intercept; }
-		public function getCoefficients():Array { return coefficients; }
-		
-		private var intercept:Number = NaN;
-		private var slope:Number = NaN;
-		private var rSquared:Number = NaN;
-		private var coefficients:Array = null;
-		
-		private var tempRange:Range = new Range();
-		private var tempPoint:Point = new Point();
-		private var tempPoint2:Point = new Point();
-
-		override public function drawBackground(dataBounds:IBounds2D, screenBounds:IBounds2D, destination:BitmapData):void
-		{
-			var g:Graphics = tempShape.graphics;
-			g.clear();
-			
-			if(currentTrendline.value == LINEAR)
-			{
-//				g.clear();
-//				if(!isNaN(intercept))
-//				{
-//					tempPoint.x = dataBounds.getXMin();
-//					tempPoint2.x = dataBounds.getXMax();
-//					
-//					tempPoint.y = (slope*tempPoint.x)+intercept;
-//					tempPoint2.y = (slope*tempPoint2.x)+intercept;
-//					
-//					tempRange.setRange( dataBounds.getYMin(), dataBounds.getYMax() );
-//					
-//					// constrain yMin to be within y range and derive xMin from constrained yMin
-//					tempPoint.x = tempPoint.x + (tempRange.constrain(tempPoint.y) - tempPoint.y) / slope;
-//					tempPoint.y = tempRange.constrain(tempPoint.y);
-//					
-//					// constrain yMax to be within y range and derive xMax from constrained yMax
-//					tempPoint2.x = tempPoint.x + (tempRange.constrain(tempPoint2.y) - tempPoint.y) / slope;
-//					tempPoint2.y = tempRange.constrain(tempPoint2.y);
-//					
-//					dataBounds.projectPointTo(tempPoint,screenBounds);
-//					dataBounds.projectPointTo(tempPoint2,screenBounds);
-//					lineStyle.beginLineStyle(null,g);
-//					//g.lineStyle(lineThickness.value, lineColor.value,lineAlpha.value,true,LineScaleMode.NONE);
-//					g.moveTo(tempPoint.x,tempPoint.y);
-//					g.lineTo(tempPoint2.x,tempPoint2.y);
-//					
-//					destination.draw(tempShape);
-//				}
-			}	
-			else if (currentTrendline.value == POLYNOMIAL)
-			{
-				points = new Vector.<Number>;
-				drawCommand = new Vector.<int>;
-				
-				if (coefficients != null)
-				{
-					// ToDo Use screenBounds to determine how many points should be drawn
+					
 					// Preprocess coefficients ==> It might return NaN in higher degree
 					for (var i:int = 0; i < coefficients.length; i++)
 					{

							i--;
						}
					}
					
					coefficients.reverse();

					var flag:Boolean = true;
					 for (var x:int = dataBounds.getXMin(); x < dataBounds.getXMax(); x++)
					 {
						tempPoint.x = x;
						tempPoint.y = polynomial(coefficients, x);
						dataBounds.projectPointTo(tempPoint, screenBounds);

			
			if (currentTrendline.value == POLYNOMIAL)
			{
				// ToDo Add rSquared
				Rstring = "fit <- lm(y ~ poly(x, " + polynomialDegree.value.toString() + ", raw = TRUE))\n"
					+"coef <- coefficients(fit)\n"			
				dataXY = ColumnUtils.joinColumns([xColumn, yColumn], Number, false, filteredKeySet.keys);
