Refactor generation methods in grid.

I don't create a new class.