Use defaultdict to simplify StructureEditor.