Dir refactor