added a globalstate class for managing queries