Simplify logic of manage-flags