add while loop for reding files