Optimised a couple of XML and memory block functions.