Adding scoring function