Added flattening of events (for shoebox storage)