IDEA-130359 Overlapping collapse areas not supported correctly

redone the change in a more safe way (with respect to performance)