Bit more xml processing

Starting to finish up the refactoring, almost to debugging