refactoring action_if_(mis)match directives code