Optimized the color cube helper about as much as I can.