add function to count score