reworked Query and other things