     //first row
     if(onPixels[0][x]){
       // Determine a random hue
+      
       CRGB newcolor;
       newcolor.setHSV(random(0,256), 255, 255);
       
-      new_colors[0][x][_R] = newcolor.r;
-      new_colors[0][x][_G] = newcolor.g;
-      new_colors[0][x][_B] = newcolor.b;
+      new_colors[xy2i(x,0)][_R] = newcolor.r;
+      new_colors[xy2i(x,0)][_G] = newcolor.g;
+      new_colors[xy2i(x,0)][_B] = newcolor.b;
     }
   }
   for(uint8_t y=ROWS-1; y>0; --y)
     for(uint8_t x=0; x<COLS; ++x){
       if(onPixels[y][x]){
         for(uint8_t i=0; i<3; ++i)
-          new_colors[y][x][i] = new_colors[y-1][x][i];
+          new_colors[xy2i(x,y)][i] = new_colors[xy2i(x,y-1)][i];
       } else {
         for(uint8_t i=0; i<3; ++i)
-          new_colors[y][x][i] = 0;
+          new_colors[xy2i(x,y)][i] = 0;
       }
     }
   for(uint8_t x=0; x<COLS; ++x){
     //first row -> turn off the off pixels after propagation of colour
     if(!onPixels[0][x]){
-      new_colors[0][x][_G] = 0;
-      new_colors[0][x][_R] = 0;
-      new_colors[0][x][_B] = 0;
+      new_colors[xy2i(x,0)][_G] = 0;
+      new_colors[xy2i(x,0)][_R] = 0;
+      new_colors[xy2i(x,0)][_B] = 0;
     }
   }
 }

  }
  LEDS.show();
  
  // Turn off all LEDs, initialise pixel seeds on first row
  for(uint8_t y=0; y<ROWS; ++y)
    for(uint8_t x=0; x<COLS; ++x){
      // clear pixels
      // for(uint8_t i=0; i<3; ++i)
        // colors[y][x][i] = 100;
      //seed pixels
      
      if(y==0)
        onPixels[y][x] = (random(0,10)>5);
      else
        onPixels[y][x] = false;
      
    }
  sendColors();
}


#define _G 1
#define _B 2

CRGB new_colors[NUM_LEDS];


// Return 0-based led index for 0-based x and y grid co-ordinate values
