Move files accidentily put in collects into pkgs.
Redo the calculation of opt-lambda expansion.

Closes PR 13661.
Closes PR 13584.