fixed clustering and distances to CSV