Memsetting the whole grid to NULL every time algorithm starts