Factor fix_def_expr() to fit on one page.

TODO: Order and indentation of the original code was preserved to minimize the text
differences.  Sometime later, indentation should be readjusted.
Merge pull request #610 from hildeth/factorFixDefExprs

Factor fix_def_expr() to fit on one page.

TODO: Order and indentation of the original code was preserved to minimize the text
differences. Sometime later, indentation should be readjusted.