Changes to the database queries