add better option/argument handling and add comments. also add another error check for missing files/directories.