Optimize flag actions