Added query execution code