restructuring query module