Refactor dir2ddi
Bugfix in dir2ddi