Refactor with directives