shitty state machine