Clean up, refactor production collapsing and terminal elision