ongoing
solution works but it is too slow
More efficient solution implemented.
We expand all at the beginning, then we collapse selectively.