working out iteration for assigning cosine scores