Merge branches 'simplexml-refactor' and 'sgc'