Cleanup the pixel module and implement nearest neighbour sampling