Various tweaks

Dropped map back to an array, replaced multiple new calls with a single
malloc, Imported TinyXML, assorted tidying