This if block could be moved down to where the ```<transaction>``` element is being populated now, for clarity.