Added a flag counter