Move temp dir to a method