Cleaned up implementation.

Added new function to handle reporting differences to the display
or to the script file.
Cleaned up trailing whitespace and added blank lines before/after
functions.