updated euclidean distance