Added checking that input file exists.