add switchDirective