Improved input file reading.