updated making directories for intermediate files