redid button state machine