Began work on output data to csv file while running in background - not finished