Added switch debouncing