added code to sort distances
have code to compute distances and output to file, not sure if this will be the most useful thing.