some changes to file reading