moved out file reading