Adding cosine distance.