working on a non-unimodal version (just using minimum distances)