Pretty hackity, but good learning experience for working with grids