changed output to text file in simulation and edited comments