added sorting and labels for distance matrix