finished query, and bugs