Added adequate error checking for input file.