More parser tests and some refactoring.