Clean up error handling
Refreshed and starting to look like the ebnf. Old stuff kept for reference.