refactoring, query API