Did a little refactoring to minimize the cost of color mapping and putting pixels on the canvas