This code has no comments whatsoever. I know you intend much more cleanup to come anyway, but this can make it hard even to review the code and give advice on the directions you are taking.
I don't understand why you need the hairy ev_array logic at all. There isn't really any extra information you need to record, is there? Each "extra" event follows exactly one particular previous event, so it's just a very simple state machine. Thanks, Roland