Internal calculation of score