Added garbage collection to tree