Added code to debounce switch driven inputs.