performance enhancement for pixelcolorer.js, changes applied O(n)