creating the score function