If we’re up for post-processing, I thought @Vsotvep’s algorithm sounded great:
Did someone find a major flaw?