better argument checking, and test input file exists