refactored and added tagtree