making boss state machine