build merge cells and collapse cells function after initial generation