Add functionality to automatically create directories.