Add logic to calculate Euclidean distance