Reading data from files and outputting data