Improved parsing and test coverage

Fixed issues, added more xml support and many more tests.