edited score counting algoritm