extractCollapsed re-implemented