xml code refactoring