add score counting function