removed the loop that assumes all the output pins are in sequence starting from kChannelFirstPin. We now define the pins for each colour in each channel explicitly in an array, and the incoming RGB data gets sent out over analogWrite to the pins appropriate to your LED strip (where DIODER uses the GBR order)
reduced the delay for waiting for the serial port to be ready on the Arduino Mega
fixed mistake in top-right box using borderBot instead of borderTop for averaging the colours, leading to weird/dim colours
made the order of the operands consistent with all the rest of the calculations