refactored out a grid class