refactoring near complete code, next XML V2