replacing the code to retrieve file data to use a yield generator to improve memory usage and startup performance