Code refactor

Added reset input function.  cleaned up un-needed code.  added comments
to provide clarity.