Cleaned up loop for input file stream.