Revised generate.py for individual flag runs