refactor fileRead method