Overhauled xml formatter as it just wasn't producing expected results.