reorganization of queries