Added MAX_ERROR_DEBOUNCES to adjust sensitivity to errors.