updated grid

optimized grid generator