optimized queries
fixed bugs