change query to class