update the score function