Changed the debounce scheme to attempt to remove glitches.