change in reading files

use freed function to read data files