tests and slight parser refactor