Renamed detail to events, added generation of detail by state.