Ok, some thoughts...
Redesign the code only when it is required for maintentance and flexibility. Performance is not an issue for MMA.
Sorting the list on time values may be helpful. So you only need to inspect the first element and then apply (=pop) all elements with suitable timestamps.
An option flag place=[before/after] looks confusing to me. The command is already called
After. Saying
After ... place=before... reminds me of the stupid
LOGOUT /YES=NO command (I don't recall if this was on RSTS/E, RSX or VAX/VMS).
The need for
Before disappears when execution of
After would apply to chord statements only. For example:
After Count=1 Print Foo
1 C
Print Bar
2 D
This would print
Bar Foo instead of
Foo Bar, since the
Print Bar statement does not contribute to the 'number of bars processed'.
Feasable? Or just insane?