added front-end for cosine similarity