First version of cosine distance works