fixed debounce issue using state machine. lab1 functions properly