added the rating function