generates grid