write library; parse subgroups with [] and parse multiple groups at the start;