Further improved task 3 input and output of data file.