refactor directive