update getQueries to new format and add separate getGroups function