Removed commented out code.  Renamed several variables.  Removed console logs from all but the debugging function and the response function.  Defined a hasStop function to separate the stop recognising code.