progress on tmpdirs
a refactor