Refactor xml