update score function