update grid code