Refactored for XML