Fix multi-threading safety bug
move a misplaced flag
Minor twiddling
remove pointless delete.
Remove more pointless copying
clear up who owns what data structure
Remove the backpointer
Remove dead routine
remove bogus API call
Fix mem leak
Fix double-free of data