Simulation loop