added grid, commented some logic