updated calculation of dissimilarity matrix