Fixed cosine distance. Cosine similarity was implemented, rather than distance.