updates to calc-median-distribution in sandbox/