Add TM importer tool
Do minor optimisation, mostly around memory fragmentation