changed grid layout to use parameters to retrieve grid position