added squared euclidian distance