Bug fix + tree structure