Merge functions in LMA.
Refactor CG.