added grid draw

grid draw
dynamic array allocation