Small parsing improvements.

Not been tested.
Merge pull request #1 from lukeroughley/patch-1

Small parsing improvements.