Fix parsing errors
Add tests (and stuff)