Fixed minor bugs in validation logic and xml formating after testing.