Factored out reading of input files.