Refactoring of DataDirHandler + fixed tests