define(function(require){

  var fabric = require("fabric"),
      RectBrushClass = require("extBrushes/fabric.RectBrush"),
      getRandomInt = fabric.util.getRandomInt,
      asBrush = require("./asBrush");

  function RectBrush(canvas, cfg){
    this.initialize(canvas, cfg);
  }

  RectBrush.prototype.initBrush = function() {
    this.brush = new RectBrushClass(this.canvas);
  };

  RectBrush.prototype.drawAtPoints = function( points ) {
    var originalRenderOnAddition = this.canvas.renderOnAddition;
        this.canvas.renderOnAddition = false;

    var rects = [];

    for (var i = 0, len = points.length; i < len; i++) {
      var point = points[i];
      rects.push(new fabric.Rect({
        width: getRandomInt(0, this.cfg.width),
        height: getRandomInt(0, this.cfg.width),
        left: point.x,
        top: point.y,
        fill: new fabric.Color(this.cfg.fillColor)
                .setAlpha(fabric.util.getRandomInt(0, 100) / 100)
                .toRgba(),
        hasControls: false,
        hasRotatingPoint: false,
        lockUniScaling: true
      }));
    }

    var group = new fabric.Group(rects);

    this.canvas.add(group);
    this.canvas.fire('path:created', { path: group });

    this.canvas.clearContext(this.canvas.contextTop);
    this.canvas.renderOnAddition = originalRenderOnAddition;
    this.canvas.renderAll();
  };

  asBrush.call(RectBrush.prototype);

  return RectBrush;

});
@@ -410,16 +410,11 @@
 draw
-AtPoints
+One
  = f
@@ -427,17 +427,16 @@
 n( point
-s
  ) %7B%0A   
@@ -440,240 +440,15 @@
     
-var originalRenderOnAddition = this.canvas.renderOnAddition;%0A        this.canvas.renderOnAddition = false;%0A%0A    var rects = %5B%5D;%0A%0A    for (var i = 0, len = points.length; i %3C len; i++) %7B%0A      var point = points%5Bi%5D;%0A      rects.push(
+return 
 new 
@@ -461,18 +461,16 @@
 .Rect(%7B%0A
-  
       wi
@@ -513,18 +513,16 @@
 ,%0A      
-  
 height: 
@@ -560,18 +560,16 @@
 ,%0A      
-  
 left: po
@@ -581,18 +581,16 @@
 ,%0A      
- 
- 
 top: poi
@@ -595,18 +595,16 @@
 oint.y,%0A
-  
       fi
@@ -644,18 +644,16 @@
 lColor)%0A
-  
         
@@ -722,18 +722,16 @@
         
-  
 .toRgba(
@@ -733,18 +733,16 @@
 Rgba(),%0A
-  
       ha
@@ -755,26 +755,24 @@
 ols: false,%0A
-  
       hasRot
@@ -796,18 +796,16 @@
 ,%0A      
-  
 lockUniS
@@ -825,21 +825,78 @@
     
+%7D);%0A
   %7D
-))
 ;%0A
+%0A
   
-  %7D%0A
+RectBrush.prototype.processObjects = function( objects ) %7B
 %0A   
@@ -925,17 +925,19 @@
 c.Group(
-r
+obj
 ects);%0A%0A
@@ -1018,16 +1018,352 @@
 roup %7D);
+%0A  %7D;%0A%0A  RectBrush.prototype.drawAtPoints = function( points ) %7B%0A    var originalRenderOnAddition = this.canvas.renderOnAddition;%0A        this.canvas.renderOnAddition = false;%0A%0A    var rects = %5B%5D;%0A%0A    for (var i = 0, len = points.length; i %3C len; i++) %7B%0A      rects.push(this.drawOne(points%5Bi%5D));%0A    %7D%0A%0A    this.processObjects(rects);
 %0A%0A    th

split up functions