query reworked