optimized queries
minor changes