Changed method to act on any state event
Changed tests to match changes to function