added in some optimizations that make use of an instance data array of pixels.