implements reading file.