First attempt at partial tree collapsing

See #2522