Use new 'stateChange' event in example