Refactor to use DistanceMatrix

Slower than it was before due to lots of extra validation/work being done during p-value calcs.