refactor for more re-use among directives