new directive handling, expand/collapse... refactoring needed