Refactor dir2ddi (again)