added validation for rating