Factored out the black and white pixels in grid