Add some optional trailing commas to patterns

Minor fixes to patterns to allow for trailing commas in arguments.
I take it square brackets in the pattern mean optional (i.e. it's different from regexes in this regard)?