allow custom tmp folder

there also a "lot" of cleanup that could be done.
I have batch tools to do that if you are interested in.