Added configurable debounce mode (for testing)