Refactoring to directives