speed up the checkerboard function