added function to calculate score
merging