Added checks for input and output directories.