slightly optimized queries