Small fixes: improve the situation of our tests' temp files

Plus a number of other commits cleaning up things