Improve parser and add more tests.