add Directory and refactor accordingly