rules grid generation optimized