Changing database and calculating avgRating functionality