changed the euclidean distance formula