Added code to analyze pairwise distances