moved data reading routine to separate module