tree data structure with events