COSMIT simplify paired_cosine_distances code