Improving grid generation