/scripts/: updated grid generator to handle "clear" better