fixed a query and checked for optimization, set_default_ratings_for_all needs improvement