refactor base with directory hooks