refactoring near complete code, next XML V4