refactoring
refactoring
version change
drop unneeded closes, move common code to here
move dir creation here
prepare for code refactor
 is env. var not dirname