refactors to use directives