Updated Grid so that the methods are not specific to a dimension of 3