extended to extract the flow and save the results to disk