added function for average rating