grid rerendering logic added