tree items and macros refactoring