Looking at the code, that should be no surprise. If the button is released, it goes back to state one. If it's held longer than the debounce period, state four.
I assume that nothing should happen until a one second hold. In which case, check for greater than 1000. Of course, that makes the debounce check redundant.