Added user interface which calls query functions appropriately