Added optimization options for euclidean distance formula