Faster version of pixel manipulation