First working version - Generate grid