pull from aberke: mass refactoring -- Grid is a type that handles grid logic