dir refactor