Refactored the score counting and counter logic.