Split parser function, to make more modular and testable. Moved integrationtests from ParserTests into Integration tests.