refactor into directives