     // Returns a brush based on its name (its filename minus the extension)
     Image@ GetBrushImage(String brushName)
     {
-        for(uint i = 0; i < brushes.length; ++i)
+        for (uint i = 0; i < brushes.length; ++i)
         {
-            if(brushes[i].name == brushName)
+            if (brushes[i].name == brushName)
             {
                 return brushes[i];
             }

    void BrushSelected(StringHash eventType, VariantMap& eventData)
    {
        CheckBox@ checkbox = cast<CheckBox>(eventData["Element"].GetPtr());
        if(checkbox.checked == false)
            return;
        selectedBrush = checkbox;
        selectedBrushImage = GetBrushImage(selectedBrush.name);

                                float avgB = 0.0f;

                                // Get the average of those pixels
                                for (uint i = 0; i < adjacentColors.length; ++i)
                                {
                                    avgR += adjacentColors[i].r;
                                    avgG += adjacentColors[i].g;
