added code to make grid work