essentially taking the median, again looks like it's got potential

(apart from actually working)