tree colapsing works