Query generator implemented