Euclidean distance calculation working