StateChanged event generation added.