event reordering and cleanup