Refactored xml code