Separate loopPixels in multiple functions.