rework of the score function