changed the cosine product