Refactoring (added functions checkNumArgs(), checkDir(), checkFile() (#3))