improved collapsing behavior