File read in helper function