Refactor class Directory