Refactor setting_set_flags