minor grid code refactor
Merge pull request #3 from lawmay/master

minor grid code refactor