Tidy up PBS parser and test to be more extensible.