Refactor broken directive