Changed some variables to use gridsize instead