Refactor directory support