Second pass, fully working with proper states and debouncing