moved scoring to seperate function