flag pattern and documentation