Added a distance table to WeightedMinDist for a huge speedup.