added rating calculation