Various name refactoring. No semantic changes.
Correct bug in language-reduction algorithm during flattening - ensure original_language is set to an available language