added scoring function