Added BreadthFirstSeach to split tree by layers.