added some grid code