Directory access refactoring