Improved error handling

Now has decent parser, test suite and errors.
Next step is to work out the format of the output.