first draft of automatic query tool for group structures.