updated logic for score calculation