refactored simulation file