simplified code by examining readFile.