Futher work on the JSON->XML refactoring