Save sample of pairwise distances for later use, and add ability to run as __main__.