added more logic for score