refactoring dir class