Switch internal format for numbers to all brace groups

This allows all items to be optional so keeps more of the form of
the input. There are still a couple of issues outstanding.