Added function to format data for simulation