Did some refactoring and added documentation for code related to presentation of the equation.  This was done in preparation for some new behavior and a bug fix.