Added Euclidean space distance calculation