refactoring: simplify queries