added docs cleaned up query