added functionality to create a directory to save figures in