Further work to reliably store and restore collapsed state