Code refactor

Added reset input function.  cleaned up un-needed code.  added comments
to provide clarity.
Merge branch 'master' into gh-pages