put averageColor init closer to where it is used