Add a few improvements and fixes to the state.event shell script example